<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=13426</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13426&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: DllCall WlanOpenHandle WlanEnumInterfaces».]]></description>
		<lastBuildDate>Wed, 31 Jan 2018 18:57:21 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123518#p123518</link>
			<description><![CDATA[<p>Нашел очень полезную информацию о структурах - <a href="https://maul-esel.github.io/ahkbook/en/Structures.html">https://maul-esel.github.io/ahkbook/en/Structures.html</a><br />В конечном итоге функция выглядит так:<br /></p><div class="codebox"><pre><code>
WlanEnumInterfaces(handle) {
		DllCall(&quot;wlanapi.dll\WlanEnumInterfaces&quot;
			, &quot;ptr&quot;, handle
			, &quot;ptr&quot;, 0
			, &quot;ptr*&quot;, pInterfaceList)
		array := []
		loop % (N:=NumGet(pInterfaceList+0, 0, &quot;UInt&quot;)) { ; Count of WiFi devices
			i:=A_Index-1, offset:=i*(288)
			;0 - GUID
			;1 - Description
			;2 - State
			array[i, 0] := NumGet(pInterfaceList+0,  offset+8,   &quot;UChar&quot;)
			array[i, 1] := StrGet(pInterfaceList+24, offset+256, &quot;UTF-8&quot;)
			array[i, 2] := NumGet(pInterfaceList+0,  offset+280, &quot;UInt&quot;)
		}
		return (!N?0:array)
	}
</code></pre></div><p>Позже выложу рабочий пример.</p>]]></description>
			<author><![CDATA[null@example.com (MandarinKa02)]]></author>
			<pubDate>Wed, 31 Jan 2018 18:57:21 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123518#p123518</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123516#p123516</link>
			<description><![CDATA[<p>Надо показать, что читать нужно не из самой переменной, а по адресу, который в ней содержится.<br /></p><div class="codebox"><pre><code>
NumGet(pInterfaceList + 0, 0, &quot;Int&quot;)
</code></pre></div><p>StrGet&#039;ом этот массив не извлечь. Нужно вычислять смещения нужных значений и считывать их индивидуально.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Wed, 31 Jan 2018 17:56:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123516#p123516</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123515#p123515</link>
			<description><![CDATA[<p><strong>YMP</strong>, большое спасибо за помощь. Не могли бы вы также помочь разобрать структуру WLAN_INTERFACE_INFO_LIST?<br />Пробовал получить первое значение DWORD(int32), но каждый раз возвращаются разные значения.<br /></p><div class="codebox"><pre><code>NumGet(pInterfaceList, 0, &quot;Int&quot;)</code></pre></div><p>И еще, в документации сказано, что WLAN_INTERFACE_INFO InterfaceInfo[]; - массив. Если вызвать функцией StrGet(), то в переменную поместиться массив?</p>]]></description>
			<author><![CDATA[null@example.com (MandarinKa02)]]></author>
			<pubDate>Wed, 31 Jan 2018 17:43:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123515#p123515</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123498#p123498</link>
			<description><![CDATA[<p>Вероятно, так.<br /></p><div class="codebox"><pre><code>
    WlanOpenHandle(ByRef version, ByRef handle) {
        dwClientVersion:=2
        return DllCall(&quot;wlanapi.dll\WlanOpenHandle&quot;
            , &quot;int&quot;, dwClientVersion
            , &quot;ptr&quot;, 0
            , &quot;uint*&quot;, version
            , &quot;ptr*&quot;, handle)
    }

    WlanEnumInterfaces(handle, ByRef pInterfaceList) {
        DllCall(&quot;wlanapi.dll\WlanEnumInterfaces&quot;
            , &quot;ptr&quot;, handle
            , &quot;ptr&quot;, 0
            , &quot;ptr*&quot;, pInterfaceList)
    }
</code></pre></div><p>В переменной pInterfaceList будет указатель на структуру WLAN_INTERFACE_INFO_LIST. Создавать её не надо, её создаст вызываемая функция. А данные получать, используя NumGet, в соответствии с устройством этой структуры. Потом структуру нужно удалить, используя функцию WlanFreeMemory.</p><p>Это всё я извлёк из описаний, т.к. вайфая нет и проверить не могу.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Wed, 31 Jan 2018 11:48:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123498#p123498</guid>
		</item>
		<item>
			<title><![CDATA[AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123478#p123478</link>
			<description><![CDATA[<p>Помогите с помощью dllcall вызвать две функции:<br /><a href="https://msdn.microsoft.com/en-us/library/ms706759(VS.85).aspx">WlanOpenHandle</a><br /><a href="https://msdn.microsoft.com/en-us/library/ms706716(VS.85).aspx">WlanEnumInterfaces</a><br />Никак не могу понять что не так. Вот, на чем остановился:<br /></p><div class="codebox"><pre><code>
	WlanOpenHandle(ByRef version, ByRef handle, pReserved=&quot;&quot;) {
		dwClientVersion:=2
		return DllCall(&quot;wlanapi.dll\WlanOpenHandle&quot;
			, &quot;int&quot;, dwClientVersion
			, &quot;int&quot;, pReserved
			, &quot;uint*&quot;, version:=pdwNegotiatedVersion
			, &quot;uint*&quot;, handle:=phClientHandle)
	}

	WlanEnumInterfaces(handle, ByRef list, pReserved=&quot;&quot;) {
		static PtrSize := A_PtrSize
		static ppInterfaceList, size := 16 + PtrSize
		VarSetCapacity(ppInterfaceList, size, 0)
		DllCall(&quot;wlanapi.dll\WlanEnumInterfaces&quot;
			, &quot;int&quot;, handle
			, &quot;int&quot;, pReserved
			, &quot;Ptr&quot;, &amp;ppInterfaceList) ;ppInterfaceList - это возвращаемая структура, как из нее получить данные?
	}
</code></pre></div><p>Заранее спасибо!<br />Ps Я с DllCall работаю впервые и толком ничего не знаю.</p>]]></description>
			<author><![CDATA[null@example.com (MandarinKa02)]]></author>
			<pubDate>Tue, 30 Jan 2018 18:44:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123478#p123478</guid>
		</item>
	</channel>
</rss>
