Hi
Knowing the SSID of Ad-Hoc Network does not mean that you can connect to
it.
There can be other element that are needed to configure, and in some cases
that can be a None computer device that you can not connect to at all.
Jack (MS, MVP-Networking)
"hari" <(E-Mail Removed)> wrote in message
news:C722638B-8D5A-4CF6-A366-(E-Mail Removed)...
> Hi all,
>
> 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;
> }
|