所以,基本上我拿了https://github.com/RRUZ/blog/tree/master/Winapi/WlanAPI并添加了
var
ConPrms : Tndu_WLAN_CONNECTION_PARAMETERS;
Name : WideString;
_Result: HRESULT;
begin
....
Name := WideString('MySSID');
ConPrms.wlanConnectionmode := wlan_connection_mode_auto;
ConPrms.strProfile := PWChar(Name);
ConPrms.pDot11Ssid := NIL;
// Windows XP: pDesiredBssidList member must be NULL.
ConPrms.pDesiredBssidList := NIL;
ConPrms.dot11BssType := dot11_BSS_type_any;
// Windows XP: dwflags must be set to 0
ConPrms.dwflags := 0;
_Result := WlanConnect(hClient,@pInterfaceGuid,@ConPrms,nil);
if _Result <> ERROR_SUCCESS then
begin
WriteLn('CONNECT - FAILED: ' + IntToStr(_Result) + ' - ' + SysErrorMessage(_Result));
end;
在for i := 0 to pInterface^.dwNumberOfItems - 1 do
循环中。
并且两台计算机上都出现错误1168: Element not found
。
netsh wlan
可以正常工作(我在https://www.windowscentral.com/how-connect-wi-fi-network-windows-10此处没有cmd指令)。我在做什么错了?