procedure TFORM1.Scan();
const
WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES =$00000001;
var
hClient : THandle;
dwVersion : DWORD;
ResultInt : DWORD;
pInterface : Pndu_WLAN_INTERFACE_INFO_LIST;
i : Integer;
j : Integer;
pAvailableNetworkList: Pndu_WLAN_AVAILABLE_NETWORK_LIST;
pInterfaceGuid : PGUID;
SDummy :
string;
l:tlistItem;
begin
ResultInt:=WlanOpenHandle(1,
nil, @dwVersion, @hClient);
if ResultInt<> ERROR_SUCCESS
then
begin
WriteLn('
Error Open CLient'+IntToStr(ResultInt));
Exit;
end;
ResultInt:=WlanEnumInterfaces(hClient,
nil, @pInterface);
if ResultInt<> ERROR_SUCCESS
then
begin
WriteLn('
Error Enum Interfaces '+IntToStr(ResultInt));
exit;
end;
for i := 0
to pInterface^.dwNumberOfItems - 1
do
begin
COMBOBOX1.Items.Add('
Interface ' + pInterface^.InterfaceInfo[i].strInterfaceDescription);
edit1.Text:=('
GUID ' + GUIDToString(pInterface^.InterfaceInfo[i].InterfaceGuid));
pInterfaceGuid:= @pInterface^.InterfaceInfo[pInterface^.dwIndex].InterfaceGuid;
ResultInt:=WlanGetAvailableNetworkList(hClient,pInterfaceGuid,WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES,
nil,pAvailableNetworkList);
if ResultInt<> ERROR_SUCCESS
then
begin
WriteLn('
Error WlanGetAvailableNetworkList '+IntToStr(ResultInt));
Exit;
end;
for j := 0
to pAvailableNetworkList^.dwNumberOfItems - 1
do
Begin
l:=listview1.Items.Add;
SDummy:=PAnsiChar(@pAvailableNetworkList^.Network[j].dot11Ssid.ucSSID);
l.Caption:=(SDummy);
l.SubItems.Add(Format('
%d ',[pAvailableNetworkList^.Network[j].wlanSignalQuality])+'
%');
//SDummy := GetEnumName(TypeInfo(Tndu_DOT11_AUTH_ALGORITHM),integer(pAvailableNetworkList^.Network[j].dot11DefaultAuthAlgorithm)) ;
SDummy:=DOT11_AUTH_ALGORITHM_To_String(pAvailableNetworkList^.Network[j].dot11DefaultAuthAlgorithm);
l.SubItems.Add(SDummy);
SDummy:=DOT11_CIPHER_ALGORITHM_To_String(pAvailableNetworkList^.Network[j].dot11DefaultCipherAlgorithm);
l.SubItems.Add(SDummy);
End;
end;
WlanCloseHandle(hClient,
nil);
end;