I am trying to use WlanConnect to a connect to a ad-hoc network. I am
getting the error invalid parameter.
I know the ssid of the ad-hoc network and wanna connect to it using the ssid
and not the profile name. It is an unsecure network. I found samples on the
net to connect to wifi network using the profile name and tat works for me..
but I want to connect using the SSID...
Here is the code
WLAN_CONNECTION_PARAMETERS wlanConnPara;
// set the connection mode
wlanConnPara.wlanConnectionMode = wlan_connection_mode_discovery_unsecure;
// set the profile name
wlanConnPara.strProfile = NULL;
// set the SSID
DOT11_SSID Ssid={0};
string strSsid = "harinetwork";
Ssid.uSSIDLength = (ULONG)strSsid.size();
memcpy(&Ssid.ucSSID, strSsid.c_str(), strSsid.size());
wlanConnPara.pDot11Ssid = &Ssid;
wlanConnPara.dot11BssType = dot11_BSS_type_independent;
// the desired BSSID list is empty
wlanConnPara.pDesiredBssidList = NULL;
// no connection flags
wlanConnPara.dwFlags = 0;
if((error = WlanConnect(hClient,&guid,&wlanConnPara,NULL)) == ERROR_SUCCESS)
{
cout<<"Done"<<endl;
}
else
{
cout<<"error "<<error<<endl;
}