Wlan connection issue
-
Hi! I want to connect to the
wireless access point
usingWlanConnect
function.Code:
HANDLE hClient; PWLAN_INTERFACE_INFO_LIST pIfList; PWLAN_INTERFACE_INFO pIfInfo; PWLAN_AVAILABLE_NETWORK_LIST pBssList; DWORD dwResult = 0; WLAN_CONNECTION_PARAMETERS connectionParameters; memset(&connectionParameters, 0, sizeof(WLAN_CONNECTION_PARAMETERS)); connectionParameters.wlanConnectionMode = wlan_connection_mode_profile; connectionParameters.strProfile = pBssList->Network[apIndex].strProfileName; connectionParameters.dwFlags = 0; connectionParameters.pDot11Ssid = NULL; connectionParameters.pDesiredBssidList = 0; connectionParameters.dot11BssType = dot11_BSS_type_any; dwResult = WlanConnect(hClient, &pIfInfo->InterfaceGuid, &connectionParameters, NULL); if (dwResult == ERROR_SUCCESS) { qDebug() << "Connected!"; } else { qDebug() << dwResult; }
When connecting to
open AP
I get87 error code
, it means the wrong parameter. Any ideas what parameter can be wrong? Thanks in advance. -
Hi,
How is that related to Qt ?
-
The application is built with
Qt
framework, but sinceQt
doesn't haveWireless API
, I use nativeWlan API
. So it's related now. -
From a Qt POV, it looks like QNetworkSession and QNetworkConfiguration might be what you are looking for.
However I have to disagree with your point: you are using a Windows native API. The fact that you are using Qt to build your application doesn't make asking what parameters your should use for the WlanConnect method a Qt related problem. The Microsoft forums might be a better place to learn how to use that method.
-
As a note. you did see
https://msdn.microsoft.com/en-us/library/windows/desktop/ms706613(v=vs.85).aspx
and the list of reason why/when it would return ERROR_INVALID_PARAMETER ? -
As a note. you did see
https://msdn.microsoft.com/en-us/library/windows/desktop/ms706613(v=vs.85).aspx
and the list of reason why/when it would return ERROR_INVALID_PARAMETER ?Thank you. I have check it, the same issue is still exists.
-
From a Qt POV, it looks like QNetworkSession and QNetworkConfiguration might be what you are looking for.
However I have to disagree with your point: you are using a Windows native API. The fact that you are using Qt to build your application doesn't make asking what parameters your should use for the WlanConnect method a Qt related problem. The Microsoft forums might be a better place to learn how to use that method.
Ok. I will try your suggestion.
-
I have figured it out and fixed the issue. The issue was that the
WlanSetProfile
function was not set before theWlanConnect
function.