Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than wlanapi, prefix the name with the module name and a period.
<DllImport("Wlanapi", EntryPoint := "WlanQueryInterface")> _
Public Shared Function WlanQueryInterface(<[In]> ByVal hClientHandle As IntPtr, _
<[In]> ByRef pInterfaceGuid As Guid, ByVal OpCode As WLAN_INTF_OPCODE, _
ByVal pReserved As IntPtr, <Out> ByRef pdwDataSize As UInteger, _
ByRef ppData As IntPtr, ByVal pWlanOpcodeValueType As IntPtr) As UInteger
End Function
User-Defined Types:
WLAN_INTF_OPCODE
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
Depending on the opcode, the data returned in the memory pointed to by ppData can be:
WLAN_RADIO_STATE
"DOT11_BSS_TYPE"
WLAN_INTERFACE_STATE
WLAN_CONNECTION_ATTRIBUTES
WLAN_AUTH_CIPHER_PAIR_LIST
WLAN_COUNTRY_OR_REGION_STRING_LIST
WLAN_STATISTICS
Tips & Tricks:
Please add some!
Sample Code:
C#
IntPtr handle = IntPtr.Zero;
uint negotiatedVersion;
try
{
if (WlanOpenHandle(1, IntPtr.Zero, out negotiatedVersion, ref handle) != 0)
return;
IntPtr ptr = new IntPtr();
if (WlanEnumInterfaces(handle, IntPtr.Zero, ref ptr) != 0)
return;
WLAN_INTERFACE_INFO_LIST infoList = new WLAN_INTERFACE_INFO_LIST(ptr);
WlanFreeMemory(ptr);
Guid guid;
uint dataSize;
WLAN_CONNECTION_ATTRIBUTES connection;
// Call wlanqueryinterface for all the interfaces in the list
for (int i = 0; i < infoList.dwNumberOfItems; i++)
{
guid = infoList.InterfaceInfo[i].InterfaceGuid;
if (WlanQueryInterface(handle, ref guid, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, out dataSize, ref ptr, IntPtr.Zero) != 0)
return;
// Do something here with the connection info....
WlanFreeMemory(ptr);
}
}
finally
{
if (handle != IntPtr.Zero)
WlanCloseHandle(handle, IntPtr.Zero);
}
VB.NET
Dim handle As IntPtr = IntPtr.Zero
Dim negotiatedVersion As UInteger
Try
If WlanOpenHandle(1, IntPtr.Zero, negotiatedVersion, handle) <> 0 Then
Return
End If
Dim ptr As New IntPtr()
If WlanEnumInterfaces(handle, IntPtr.Zero, ptr) <> 0 Then
Return
End If
Dim infoList As New WLAN_INTERFACE_INFO_LIST(ptr)
WlanFreeMemory(ptr)
Dim guid As Guid
Dim dataSize As UInteger
Dim connection As WLAN_CONNECTION_ATTRIBUTES
' Call wlanqueryinterface for all the interfaces in the list
For i As Integer = 0 To infoList.dwNumberOfItems - 1
guid = infoList.InterfaceInfo(i).InterfaceGuid
If WlanQueryInterface(handle, guid, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, dataSize, ptr, _
IntPtr.Zero) <> 0 Then
Return
End If
' Do something here with the connection info....
WlanFreeMemory(ptr)
Next
Finally
If handle <> IntPtr.Zero Then
WlanCloseHandle(handle, IntPtr.Zero)
End If
End Try
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).