Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use this to connect to a wifi AP and it works.

uses
…, nduWlanAPI, Windows, nduWlanTypes, …
procedure TForm1.Button1Click(Sender: TObject);
var
hClient: THandle;
dwVersion: DWORD;
ResultInt: DWORD;
pInterface: Pndu_WLAN_INTERFACE_INFO_LIST;
pConnectionParameters : tndu_WLAN_CONNECTION_PARAMETERS;
Tvar : tndu_WLAN_CONNECTION_PARAMETERS;
PConnectionParameters1 : pndu_WLAN_CONNECTION_PARAMETERS;
pAvailableNetworkList: Pndu_WLAN_AVAILABLE_NETWORK_LIST;
pInterfaceGuid: PGUID;
begin
ResultInt := WlanOpenHandle(1, nil, @dwVersion, @hClient);
ResultInt := WlanEnumInterfaces(hClient, nil, @pInterface);
pInterfaceGuid := @pInterface^.InterfaceInfo[pInterface^.dwIndex].InterfaceGuid; pConnectionParameters.wlanConnectionMode := WLAN_CONNECTION_MODE_PROFILE; pConnectionParameters.strProfile := 'MySSID';
pConnectionParameters.pDot11Ssid := nil;
pConnectionParameters.pDesiredBssidList := nil;
pConnectionParameters.dot11BssType := dot11_BSS_type_any;
pConnectionParameters.dwFlags := 0;
ResultInt := WlanConnect(hClient,
pInterfaceGuid,
@pConnectionParameters,
nil);
end;

If I export the profile to a XML file, using netsh wlan export profile name=MySSID, and change the connection mode to wlan_connection_mode_temporary_profile, how do I pass the XML to the WLanconnect function?

What I have tried:

I have no idea how to solve this. I can't find any samples on the net.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900