<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13426&amp;type=atom" />
	<updated>2018-01-31T18:57:21Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13426</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123518#p123518" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[MandarinKa02]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34409</uri>
			</author>
			<updated>2018-01-31T18:57:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123518#p123518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123516#p123516" />
			<content type="html"><![CDATA[<p>Надо показать, что читать нужно не из самой переменной, а по адресу, который в ней содержится.<br /></p><div class="codebox"><pre><code>
NumGet(pInterfaceList + 0, 0, &quot;Int&quot;)
</code></pre></div><p>StrGet&#039;ом этот массив не извлечь. Нужно вычислять смещения нужных значений и считывать их индивидуально.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2018-01-31T17:56:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123516#p123516</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123515#p123515" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[MandarinKa02]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34409</uri>
			</author>
			<updated>2018-01-31T17:43:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123515#p123515</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123498#p123498" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2018-01-31T11:48:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123498#p123498</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: DllCall WlanOpenHandle WlanEnumInterfaces]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123478#p123478" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[MandarinKa02]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34409</uri>
			</author>
			<updated>2018-01-30T18:44:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123478#p123478</id>
		</entry>
</feed>
