A. Introduction to Tools
Recently busy to change papers, but due to mobile phone no traffic, repeated sharing of computer WiFi operation has let me unbearable, and "Cheetah WiFi" "360wifi sharing" and other tools have caused the computer to sleep many times (may be the desktop USB NIC compatibility problem). So I took the time to write a handy tool that took full advantage of the Windows self-feature implementation, which mainly incorporates several commands from the command prompt:
- Set up windows to bring WiFi hotspot;
- Turn wifi on and off;
- Auto Power off and cancel;(mainly I like to sleep in bed before playing on the cell phone, and do not bother to shut down the computer)
Well part. NET to manage the system:
- Turn off the flash process (avoid the flash lock sharing function);
- automate sharing with Windows-brought libraries to avoid manual setup. (Many people may be stuck in this step)
After testing, this tool does not affect the flash heartbeat verification, the internet is stable, and will not be like a manual sharing in a few minutes after the network will be broken.
Of course , if not the campus network in Zhejiang Province, users may not need to dial this type of flash, directly open the hotspot to share.
GitHub source program (project file) : https://github.com/Blz-Galaxy/Tools-Wifi-Sharing
B. Directives and enforcement
Related command prompt (can also be called with bat script)
Here the hotspot is identified as Blz_galaxy, the password is 1234567890, please modify it yourself.
- to open a shared WiFi hotspot :
Start hostednetwork
- Timer shutdown (shutdown after 3,600 seconds):
Shutdown-s-T 3600
- The shutdown plan can also be canceled after setting the shutdown:
Shutdown-a
One more example:
Regex reg =NewRegex (@"[\u4e00-\u9fa5]");//Regular Expressionsif(Reg. IsMatch (TextBox1.Text) | |Reg. IsMatch (TextBox2.Text)) {MessageBox.Show ("cannot contain Chinese characters"); return;}if(TextBox2.Text.Length <8) {MessageBox.Show ("password more than 8 digits"); return;} _strwrite= String.Format ("Netsh wlan set hostednetwork mode=allow ssid={0} key={1}", This. TextBox1.Text, This. TextBox2.Text); _pcmd.standardinput.writeline (_strwrite);
C. System Management through C # (. NET)
- Automatically closes the specified process (such as the "singlenet" process of the Flash)
instead of manually finding a process in Task manager, rescuing people with severe phobias ~
For details, refer to: "C #" specifies the process shutdown & WiFi sharing under the Flash
- call \windows\system32\hnetcfg.dll, which enables automatic sharing with "netconlib" (Key)
Try{ stringConnectiontoshare = This. TextBox3.Text;//network connections that are shared stringSharedforconnection = This. Textbox4.text;//Network connections that need to be sharedNetsharingmanager Manager=NewNetsharingmanager (); varConnections =Manager. Enumeveryconnection; foreach(Inetconnection Cinchconnections) { varProps =Manager.netconnectionprops[c]; varSharingcfg =Manager. INETSHARINGCONFIGURATIONFORINETCONNECTION[C]; if(Props. Name = =connectiontoshare) {sharingcfg.enablesharing (tagsharingconnectiontype.icssharingtype_public); } Else if(Props. Name = =sharedforconnection) {sharingcfg.enablesharing (tagsharingconnectiontype.icssharingtype_private); } }}Catch{MessageBox.Show ("please open network and Sharing Center • See if you are connected internet! ","Tips", MessageBoxButtons.OK, messageboxicon.information);}
Replace manual access to "Network Sharing Center, change adapter settings->singlenetpppoe properties, share," Check allow sharing internet-> Select Share Target "This series of actions, lazy Gospel ~
"C #" WinForm Tool-Quick share WiFi (source code) under Flash