How to share internet with C++
Enabling Hosted network:
Please enable WIFI (Wireless Network Connection).
you need administrator rights to do the following instructions,
we can share internet from PC (windows7 or >) by enabling the "hosted network" from CMD (Commande DOS)
netsh wlan set hostednetwork mode="allow" ssid="name" key="12345678"
netsh wlan start hosted network
now a the (Wireless Network Connection 2) will be enabled and the hosted network start
if you want stop it put:
netsh wlan stop hosted network
if you want disable it put:
netsh wlan set hostednetwork mode="disallow"
sharing internet
1- give it a name
2- put your password
3- presse creat
now it will start,
in your PC go to Control Panel\Network and Internet\Network Connections if you have internet in Local Area Connection presse properties clic in sharing tab check allow other network users to connect through this computer's internet connections in Home networking connection: choose Wireless Network Connection 2 then press OK.
in your android phone go to wifi options stay pressing in hotspot a few seconds then check show advanced options,
in ip config choose static and:
in IP adresse put 192.168.137.2 (2 or other number until 255)
in gateway put 192.168.137.1 (the ip adresse of Wireless Network Connection 2)
in DNS put 8.8.8.8
I made an application do this work for me:
only .exe
PCtoAndroid_Hotspotr_for_win7.zip
very nice application from internet:
http://www.mypublicwifi.com/publicwifi/fr/index.html
Embarcadero® C++Builder XE8
....
NETCON_PROPERTIES* pNP = NULL;
pNC->GetProperties( &pNP );//AnsiString name= pNP->pszwName;
if (name == ComboBox1->Text )
{//9
pNSM->get_INetSharingConfigurationForINetConnection (pNC, &pNSC);
pNSC->EnableSharing(ICSSHARINGTYPE_PUBLIC); //enable sharing (who give internnet)
pNSC->Release();
}//9
...........
if (pNC)
{//7
NETCON_PROPERTIES* pNP = NULL;
pNC->GetProperties( &pNP );//
AnsiString name= pNP->pszwName;
if (name == ComboBox2->Text )
{//8
//pVWifi = pNP;
pNSM->get_INetSharingConfigurationForINetConnection(pNC,&pVWifiNSC);
pVWifiNSC->EnableSharing(ICSSHARINGTYPE_PRIVATE); //enable internet sharing(who take internet)
}
....
download the project:
Embarcadero® C++Builder XE8
hotspot.zip






Aucun commentaire:
Enregistrer un commentaire