<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
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
Defines various opcodes used to set and query parameters for an interface.
11/6/2008 2:20:08 AM - -174.130.71.133
TODO - a short description
3/4/2012 4:01:07 AM - Richard von Mallesch-124.171.28.244
Defines a basic service set (BSS) network type.
10/8/2009 7:53:09 PM - -71.165.233.91
Indicates the state of an interface.
10/8/2009 8:16:54 PM - -71.165.233.91
Defines the attributes of a wireless connection.
4/2/2009 9:41:23 PM - -130.225.243.84
The WLAN_STATISTICS structure contains assorted statistics about an interface.
11/14/2009 5:07:32 PM - -90.207.27.110
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).