在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例常用C#方法 → wifi客户端连接(一键共享WiFi上网)源码

wifi客户端连接(一键共享WiFi上网)源码

常用C#方法

下载此实例
  • 开发语言:C#
  • 实例大小:0.14M
  • 下载次数:65
  • 浏览次数:800
  • 发布时间:2016-05-08
  • 实例类别:常用C#方法
  • 发 布 人:moxigua
  • 文件格式:.zip
  • 所需积分:2
 相关标签: 客户端 wifi adsl 光纤

实例介绍

【实例简介】

Wi-Fi热点v2.1

----------------

精简核心代码优化提升响应速度

为系统安全稳定考虑 不再支持Windows7以下系统

增加Wi-Fi热点FAQ常用问题指南

优化部分交互互动

加入自动更新升级机制


Wi-Fi热点v2.0

----------------

全面支持公众网(ADSL、光纤、内部网)以及电信联通校园网,实现一键共享WiFi上网

修复部分BUG,优化程序,占用资源更小

兼容Win98、Win2000、Win2003、WinXp、WinVista、Win7、Win8市面上所有Windows系统

优化退出消息泵,WiFi未启动情况下,将直接退出程序

增加WiFi在线数监控以及查看在线列表详细信息功能

智能判断WinVista/7以下系统,若不支持Aero特效,将自动转换UI界面为黑白高对比。

本程序由C#编写,WinVista/7 以下系统需要.Net框架支持。


Wi-Fi热点v1.0

----------------

仅支持电信高校NetKeeper网络。突破NetKeeper限制一键实现共享WiFi上网

必须使用win7以上系统才能使用

实现托盘功能,最小化到后台运行

本程序由C#编写,WinVista/7 以下系统需要.Net框架支持。

【实例截图】

【核心代码】


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
using NETCONLib;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Windows.Forms;
using System.Xml;
 
namespace WiFi
{
    public class Form1 : Form
    {
        public struct MARGINS
        {
            public int Left;
 
            public int Right;
 
            public int Top;
 
            public int Bottom;
        }
 
        private bool showing = true;
 
        private static string dirPath;
 
        private new string Show = "";
 
        private string Shower = "";
 
        private static string Share = "";
 
        private string client = "";
 
        private bool wifi = false;
 
        private bool xz = true;
 
        private IContainer components = null;
 
        private ComboBox comboBox1;
 
        private Label label6;
 
        private Button button2;
 
        private TextBox textBox_key;
 
        private Label label3;
 
        private Label label2;
 
        private TextBox textBox_name;
 
        private Button button1;
 
        private Timer timer1;
 
        private NotifyIcon notifyIcon1;
 
        private ContextMenuStrip contextMenuStrip1;
 
        private ToolStripMenuItem 关于ToolStripMenuItem;
 
        private ToolStripMenuItem 微博ToolStripMenuItem;
 
        private ToolStripMenuItem 退出ToolStripMenuItem;
 
        private Label label1;
 
        private Label Online;
 
        private Timer timer2;
 
        private Label label4;
 
        private Label label5;
 
        private Label label7;
 
        private Label label8;
 
        private Label label9;
 
        [DllImport("dwmapi.dll", PreserveSig = false)]
        private static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref Form1.MARGINS margins);
 
        [DllImport("dwmapi.dll", PreserveSig = false)]
        private static extern bool DwmIsCompositionEnabled();
 
        [DllImport("user32.dll")]
        public static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);
 
        protected override void WndProc(ref Message m)
        {
            int msg = m.Msg;
            if (msg != 16)
            {
                base.WndProc(ref m);
            }
            else if (this.wifi)
            {
                DialogResult dialogResult = MessageBox.Show("退出将会自动关闭WiFi,是否要真的退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (dialogResult == DialogResult.Yes)
                {
                    this.Stop();
                    Form1.SendMessage((int)base.Handle, 2, (int)m.WParam, (int)m.LParam);
                }
            }
            else
            {
                Application.Exit();
            }
        }
 
        public Form1()
        {
            this.InitializeComponent();
            base.Opacity = 0.0;
            this.timer1.Start();
        }
 
        private void CheakSystem()
        {
            OperatingSystem oSVersion = Environment.OSVersion;
            PlatformID platform = oSVersion.Platform;
            if (platform == PlatformID.Win32NT)
            {
                switch (oSVersion.Version.Major)
                {
                case 5:
                    switch (oSVersion.Version.Minor)
                    {
                    case 0:
                        Application.Exit();
                        MessageBox.Show("(*当前系统:Windows 2000)Sorry,为了保证系统安全稳定,Windows7以下系统暂不支持服务。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        break;
                    case 1:
                        Application.Exit();
                        MessageBox.Show("(*当前系统:Windows XP)Sorry,为了保证系统安全稳定,Windows7以下系统暂不支持服务。。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        break;
                    case 2:
                        Application.Exit();
                        MessageBox.Show("(*当前系统:Windows 2003)Sorry,为了保证系统安全稳定,Windows7以下系统暂不支持服务。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        break;
                    }
                    break;
                case 6:
                    switch (oSVersion.Version.Minor)
                    {
                    }
                    break;
                }
            }
        }
 
        public string executeCmd(string Command)
        {
            Process process = new Process();
            process.StartInfo.FileName = " cmd.exe ";
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardInput = true;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.CreateNoWindow = true;
            process.Start();
            process.StandardInput.WriteLine(Command);
            process.StandardInput.WriteLine("exit");
            this.Show = process.StandardOutput.ReadToEnd();
            process.WaitForExit();
            process.Close();
            return this.Show;
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            Form1.Kill();
            if (this.textBox_name.Text.Trim() == "" || this.textBox_key.Text.Length < 8)
            {
                MessageBox.Show("名称不能为空且密码不能少于8位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else if (this.textBox_name.Text.Trim() == "输入热点名称..." || this.textBox_key.Text == "输入热点密码...")
            {
                MessageBox.Show("热点名称与密码不能使用中文\r\n只能使用英文(a~z / A~Z)数字(0~9)", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else if (this.comboBox1.Text == "")
            {
                MessageBox.Show("请选择拥有访问Internet权限的网络连接!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                string text = this.Establish();
                if (text.IndexOf("承载网络模式已设置为允许") > -1 && text.IndexOf("已成功更改承载网络的 SSID。") > -1 && text.IndexOf("已成功更改托管网络的用户密钥密码。") > -1)
                {
                    Form1.Share = this.comboBox1.Text;
                    this.Start();
                }
                else
                {
                    MessageBox.Show("对不起,搭建/启用WiFi热点失败,请重试!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            this.Stop();
        }
 
        private static void Kill()
        {
            Process[] processesByName = Process.GetProcessesByName("NetKeeper");
            Process[] array = processesByName;
            for (int i = 0; i < array.Length; i  )
            {
                Process process = array[i];
                process.Kill();
                MessageBox.Show("已成功解除Netkeeper限制", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
 
        private string Establish()
        {
            string command = "netsh wlan set hostednetwork mode=allow ssid="   this.textBox_name.Text   " key="   this.textBox_key.Text;
            return this.executeCmd(command);
        }
 
        private void Start()
        {
            try
            {
                this.executeCmd("netsh wlan start hostednetwork").IndexOf("已启动承载网络");
                Form1.EnableInternetConnectionSharing();
                int timeout = 1000;
                string tipTitle = "温馨提示";
                string tipText = this.textBox_name.Text   " 热点已开启,运行中。 ";
                ToolTipIcon tipIcon = ToolTipIcon.Info;
                this.notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon);
                this.timer2.Start();
                this.wifi = true;
                this.button1.Visible = false;
                this.button2.Visible = true;
                this.label1.Visible = true;
                this.Online.Visible = true;
                this.textBox_name.Enabled = false;
                this.textBox_key.Enabled = false;
            }
            catch (Exception var_4_B6)
            {
            }
        }
 
        private void Stop()
        {
            try
            {
                this.timer2.Stop();
                this.executeCmd("netsh wlan stop hostednetwork").IndexOf("已停止承载网络");
                int timeout = 1000;
                string tipTitle = "温馨提示";
                string tipText = this.textBox_name.Text   " 热点已关闭。";
                ToolTipIcon tipIcon = ToolTipIcon.Info;
                this.notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon);
                this.wifi = false;
                this.button2.Visible = false;
                this.button1.Visible = true;
                this.label1.Visible = false;
                this.Online.Visible = false;
                this.textBox_name.Enabled = true;
                this.textBox_key.Enabled = true;
                this.ChangeMessage("Wi-Fi热点 Ver2.1");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 
        public static void EnableInternetConnectionSharing()
        {
            try
            {
                string share = Form1.Share;
                string b = "无线网络连接 2";
                NetSharingManager netSharingManager = new NetSharingManagerClass();
                INetSharingEveryConnectionCollection enumEveryConnection = netSharingManager.EnumEveryConnection;
                foreach (INetConnection pNetConnection in enumEveryConnection)
                {
                    INetConnectionProps netConnectionProps = netSharingManager.get_NetConnectionProps(pNetConnection);
                    INetSharingConfiguration netSharingConfiguration = netSharingManager.get_INetSharingConfigurationForINetConnection(pNetConnection);
                    if (netConnectionProps.Name == share)
                    {
                        netSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE.ICSSHARINGTYPE_PUBLIC);
                    }
                    else if (netConnectionProps.Name == b)
                    {
                        netSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE.ICSSHARINGTYPE_PRIVATE);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            double num = 0.1;
            if (this.showing)
            {
                if (base.Opacity   num >= 1.0)
                {
                    base.Opacity = 1.0;
                    this.timer1.Stop();
                }
                else
                {
                    base.Opacity  = num;
                }
            }
            else if (base.Opacity - num <= 0.0)
            {
                base.Opacity = 0.0;
                this.timer1.Stop();
            }
            else
            {
                base.Opacity -= num;
            }
        }
 
        protected override void OnLoad(EventArgs e)
        {
            this.CheakSystem();
            ServiceController serviceController = new ServiceController("SharedAccess");
            try
            {
                if (serviceController.Status.Equals(ServiceControllerStatus.Stopped))
                {
                    serviceController.Start();
                }
            }
            catch (Exception var_1_3F)
            {
                MessageBox.Show("启动Internet Connection Sharing (ICS)服务项失败!\r\n请到控制面板--管理工具--服务手动启动Internet Connection Sharing (ICS)服务项\r\nWiFi热点需要Internet Connection Sharing (ICS)服务项的支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                Application.Exit();
            }
            NetworkInterface[] allNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
            NetworkInterface[] array = allNetworkInterfaces;
            for (int i = 0; i < array.Length; i  )
            {
                NetworkInterface networkInterface = array[i];
                if (networkInterface.OperationalStatus.ToString() == "Up")
                {
                    this.comboBox1.Items.Add(networkInterface.Name);
                }
            }
            if (Form1.DwmIsCompositionEnabled())
            {
                this.AgainLoad();
            }
        }
 
        private void AgainLoad()
        {
            Form1.MARGINS mARGINS = default(Form1.MARGINS);
            mARGINS.Right = (mARGINS.Left = (mARGINS.Top = (mARGINS.Bottom = base.Width   base.Height)));
            Form1.DwmExtendFrameIntoClientArea(base.Handle, ref mARGINS);
        }
 
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            if (Form1.DwmIsCompositionEnabled())
            {
                e.Graphics.Clear(Color.Black);
            }
        }
 
        private void Main_Resize(object sender, EventArgs e)
        {
            if (base.WindowState == FormWindowState.Minimized)
            {
                base.Hide();
                base.ShowInTaskbar = false;
                this.notifyIcon1.Visible = true;
                int timeout = 1000;
                string tipTitle = "温馨提示";
                string tipText = "Wi-Fi热点托盘运行ing~";
                ToolTipIcon tipIcon = ToolTipIcon.Info;
                this.notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon);
            }
        }
 
        private void notifyIcon1_DoubleClick(object sender, EventArgs e)
        {
            base.Visible = true;
            base.Show();
            base.ShowInTaskbar = true;
            this.AgainLoad();
            base.WindowState = FormWindowState.Normal;
            this.notifyIcon1.Visible = true;
        }
 
        private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int timeout = 1000;
            string tipTitle = "关于作者";
            string tipText = "谭健~90后~男~爱生活~纯治愈系~";
            ToolTipIcon tipIcon = ToolTipIcon.Info;
            this.notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon);
        }
 
        private void 微博ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Help.ShowHelp(this, "http://t.qq.com/onlyloved");
            int timeout = 1000;
            string tipTitle = "关于微博";
            string tipText = "欢迎收听我的腾讯微博,互听关注~";
            ToolTipIcon tipIcon = ToolTipIcon.Info;
            this.notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon);
        }
 
        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
 
        private void timer2_Tick(object sender, EventArgs e)
        {
            Process process = new Process();
            process.StartInfo.FileName = " cmd.exe ";
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardInput = true;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.CreateNoWindow = true;
            process.Start();
            process.StandardInput.WriteLine("netsh wlan show hostednetwork");
            process.StandardInput.WriteLine("exit");
            this.Show = process.StandardOutput.ReadToEnd();
            process.WaitForExit();
            process.Close();
            this.Shower = this.Show.Substring(this.Show.LastIndexOf("客户端数")   12, 3);
            this.client = this.Show.Substring(this.Show.LastIndexOf("客户端数")   23, this.Show.Length - this.Show.LastIndexOf("客户端数") - 23);
            this.client = this.client.Remove(this.client.LastIndexOf("证")   1);
            this.Shower.Replace('\r', '\0');
            this.Online.Text = this.Shower;
            this.ChangeMessage(this.textBox_name.Text   "热点运行中...在线数: "   this.Shower);
        }
 
        private void comboBox1_Enter(object sender, EventArgs e)
        {
            if (this.xz)
            {
                MessageBox.Show("请选择可以访问Internet的连接:\r\n电信/联通校园网请选择ChinaNetSNWide/ChianUnicomSNWide\r\n公众网请选择对应的PPPOE拨号连接或小区光纤", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.xz = false;
            }
        }
 
        private void label1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("在线用户信息\r\n┄┄┄┄┄┄\r\n"   this.client   "\r\n", "在线详细信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
 
        private void ChangeMessage(string message)
        {
            base.Invoke(new MethodInvoker(delegate
            {
                this.Text = message;
            }));
        }
 
        private void textBox_name_Click(object sender, EventArgs e)
        {
            this.textBox_name.Text = "";
        }
 
        private void textBox_name_Leave(object sender, EventArgs e)
        {
            if (this.textBox_name.Text == "")
            {
                this.textBox_name.Text = "输入热点名称...";
            }
        }
 
        private void textBox_key_Click(object sender, EventArgs e)
        {
            this.textBox_key.Text = "";
        }
 
        private void textBox_key_Leave(object sender, EventArgs e)
        {
            if (this.textBox_key.Text == "")
            {
                this.textBox_key.Text = "输入热点密码...";
            }
        }
 
        private void label8_Click(object sender, EventArgs e)
        {
            Help.ShowHelp(this, "http://inj.me/?p=228");
        }
 
        private void label9_Click(object sender, EventArgs e)
        {
            Form1.dirPath = Form1.GetConfigValue("conf.config", "Url");
            string theLastUpdateTime = Form1.GetTheLastUpdateTime(Form1.dirPath);
            string configValue = Form1.GetConfigValue("conf.config", "UpDate");
            if (!string.IsNullOrEmpty(theLastUpdateTime) && !string.IsNullOrEmpty(configValue))
            {
                if (DateTime.Compare(Convert.ToDateTime(theLastUpdateTime, CultureInfo.InvariantCulture), Convert.ToDateTime(configValue, CultureInfo.InvariantCulture)) > 0)
                {
                    MessageBox.Show("发现新版本,点击确定开始更新.", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    AutoUpdater autoUpdater = new AutoUpdater();
                    autoUpdater.ShowDialog();
                }
                else
                {
                    MessageBox.Show("恭喜!当前程序是最新版本.", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
 
        internal static string GetConfigValue(string path, string appKey)
        {
            XmlDocument xmlDocument = new XmlDocument();
            XmlElement xmlElement = null;
            try
            {
                xmlDocument.Load(path);
                XmlNode xmlNode = xmlDocument.SelectSingleNode("//appSettings");
                xmlElement = (XmlElement)xmlNode.SelectSingleNode("//add[@key=\""   appKey   "\"]");
            }
            catch (XmlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            string result;
            if (xmlElement != null)
            {
                result = xmlElement.GetAttribute("value");
            }
            else
            {
                result = "";
            }
            return result;
        }
 
        private static string GetTheLastUpdateTime(string Dir)
        {
            string result = "";
            string address = Dir   "AutoUpdater/AutoUpdater.xml";
            try
            {
                WebClient webClient = new WebClient();
                Stream stream = webClient.OpenRead(address);
                XmlTextReader xmlTextReader = new XmlTextReader(stream);
                while (xmlTextReader.Read())
                {
                    if (xmlTextReader.Name == "UpdateTime")
                    {
                        result = xmlTextReader.GetAttribute("Date");
                        break;
                    }
                }
                xmlTextReader.Close();
                stream.Close();
            }
            catch (WebException ex)
            {
                MessageBox.Show(ex.Message);
            }
            return result;
        }
 
        protected override void Dispose(bool disposing)
        {
            if (disposing && this.components != null)
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
            this.comboBox1 = new ComboBox();
            this.label6 = new Label();
            this.button2 = new Button();
            this.textBox_key = new TextBox();
            this.label3 = new Label();
            this.label2 = new Label();
            this.textBox_name = new TextBox();
            this.button1 = new Button();
            this.timer1 = new Timer(this.components);
            this.notifyIcon1 = new NotifyIcon(this.components);
            this.contextMenuStrip1 = new ContextMenuStrip(this.components);
            this.关于ToolStripMenuItem = new ToolStripMenuItem();
            this.微博ToolStripMenuItem = new ToolStripMenuItem();
            this.退出ToolStripMenuItem = new ToolStripMenuItem();
            this.label1 = new Label();
            this.Online = new Label();
            this.timer2 = new Timer(this.components);
            this.label4 = new Label();
            this.label5 = new Label();
            this.label7 = new Label();
            this.label8 = new Label();
            this.label9 = new Label();
            this.contextMenuStrip1.SuspendLayout();
            base.SuspendLayout();
            this.comboBox1.BackColor = SystemColors.Window;
            this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox1.ForeColor = Color.Black;
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new Point(122, 100);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new Size(100, 20);
            this.comboBox1.TabIndex = 19;
            this.comboBox1.Enter  = new EventHandler(this.comboBox1_Enter);
            this.label6.AutoSize = true;
            this.label6.BackColor = SystemColors.Desktop;
            this.label6.ForeColor = Color.Transparent;
            this.label6.Location = new Point(63, 103);
            this.label6.Name = "label6";
            this.label6.Size = new Size(53, 12);
            this.label6.TabIndex = 18;
            this.label6.Text = "共享网络";
            this.button2.BackColor = Color.Black;
            this.button2.FlatStyle = FlatStyle.Flat;
            this.button2.ForeColor = Color.Transparent;
            this.button2.Location = new Point(139, 138);
            this.button2.Name = "button2";
            this.button2.Size = new Size(83, 23);
            this.button2.TabIndex = 17;
            this.button2.Text = "关闭热点";
            this.button2.UseVisualStyleBackColor = false;
            this.button2.Visible = false;
            this.button2.Click  = new EventHandler(this.button2_Click);
            this.textBox_key.BackColor = Color.Black;
            this.textBox_key.BorderStyle = BorderStyle.FixedSingle;
            this.textBox_key.ForeColor = Color.Transparent;
            this.textBox_key.Location = new Point(122, 65);
            this.textBox_key.Name = "textBox_key";
            this.textBox_key.Size = new Size(100, 21);
            this.textBox_key.TabIndex = 16;
            this.textBox_key.Text = "输入热点密码...";
            this.textBox_key.Click  = new EventHandler(this.textBox_key_Click);
            this.textBox_key.Leave  = new EventHandler(this.textBox_key_Leave);
            this.label3.AutoSize = true;
            this.label3.BackColor = SystemColors.Desktop;
            this.label3.ForeColor = Color.Transparent;
            this.label3.Location = new Point(63, 68);
            this.label3.Name = "label3";
            this.label3.Size = new Size(53, 12);
            this.label3.TabIndex = 15;
            this.label3.Text = "WiFi密码";
            this.label2.AutoSize = true;
            this.label2.BackColor = SystemColors.Desktop;
            this.label2.ForeColor = Color.Transparent;
            this.label2.Location = new Point(63, 31);
            this.label2.Name = "label2";
            this.label2.Size = new Size(53, 12);
            this.label2.TabIndex = 14;
            this.label2.Text = "WiFi名称";
            this.textBox_name.BackColor = Color.Black;
            this.textBox_name.BorderStyle = BorderStyle.FixedSingle;
            this.textBox_name.ForeColor = Color.Transparent;
            this.textBox_name.Location = new Point(122, 28);
            this.textBox_name.Name = "textBox_name";
            this.textBox_name.Size = new Size(100, 21);
            this.textBox_name.TabIndex = 13;
            this.textBox_name.Text = "输入热点名称...";
            this.textBox_name.Click  = new EventHandler(this.textBox_name_Click);
            this.textBox_name.Leave  = new EventHandler(this.textBox_name_Leave);
            this.button1.BackColor = Color.Black;
            this.button1.FlatStyle = FlatStyle.Flat;
            this.button1.ForeColor = Color.Transparent;
            this.button1.Location = new Point(139, 138);
            this.button1.Name = "button1";
            this.button1.Size = new Size(83, 23);
            this.button1.TabIndex = 10;
            this.button1.Text = "开启热点";
            this.button1.UseVisualStyleBackColor = false;
            this.button1.Click  = new EventHandler(this.button1_Click);
            this.timer1.Tick  = new EventHandler(this.timer1_Tick);
            this.notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
            this.notifyIcon1.Icon = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon");
            this.notifyIcon1.Text = "Kill Netkeeper Wi-Fi Share";
            this.notifyIcon1.Visible = true;
            this.notifyIcon1.DoubleClick  = new EventHandler(this.notifyIcon1_DoubleClick);
            this.contextMenuStrip1.Items.AddRange(new ToolStripItem[]
            {
                this.关于ToolStripMenuItem,
                this.微博ToolStripMenuItem,
                this.退出ToolStripMenuItem
            });
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new Size(101, 70);
            this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
            this.关于ToolStripMenuItem.Size = new Size(100, 22);
            this.关于ToolStripMenuItem.Text = "关于";
            this.关于ToolStripMenuItem.Click  = new EventHandler(this.关于ToolStripMenuItem_Click);
            this.微博ToolStripMenuItem.Name = "微博ToolStripMenuItem";
            this.微博ToolStripMenuItem.Size = new Size(100, 22);
            this.微博ToolStripMenuItem.Text = "微博";
            this.微博ToolStripMenuItem.Click  = new EventHandler(this.微博ToolStripMenuItem_Click);
            this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
            this.退出ToolStripMenuItem.Size = new Size(100, 22);
            this.退出ToolStripMenuItem.Text = "退出";
            this.退出ToolStripMenuItem.Click  = new EventHandler(this.退出ToolStripMenuItem_Click);
            this.label1.AutoSize = true;
            this.label1.BackColor = SystemColors.Desktop;
            this.label1.Cursor = Cursors.Hand;
            this.label1.Font = new Font("宋体", 9f, FontStyle.Underline, GraphicsUnit.Point, 134);
            this.label1.ForeColor = Color.Transparent;
            this.label1.Location = new Point(63, 143);
            this.label1.Name = "label1";
            this.label1.Size = new Size(41, 12);
            this.label1.TabIndex = 20;
            this.label1.Text = "在线数";
            this.label1.Visible = false;
            this.label1.Click  = new EventHandler(this.label1_Click);
            this.Online.AutoSize = true;
            this.Online.BackColor = SystemColors.Desktop;
            this.Online.ForeColor = Color.Transparent;
            this.Online.Location = new Point(104, 143);
            this.Online.Name = "Online";
            this.Online.Size = new Size(11, 12);
            this.Online.TabIndex = 21;
            this.Online.Text = "0";
            this.Online.Visible = false;
            this.timer2.Interval = 5000;
            this.timer2.Tick  = new EventHandler(this.timer2_Tick);
            this.label4.AutoSize = true;
            this.label4.BackColor = SystemColors.Desktop;
            this.label4.ForeColor = Color.Transparent;
            this.label4.Location = new Point(29, 197);
            this.label4.Name = "label4";
            this.label4.Size = new Size(227, 12);
            this.label4.TabIndex = 22;
            this.label4.Text = "支持公众网与校园网(智能解封NetKeeper)";
            this.label5.AutoSize = true;
            this.label5.BackColor = SystemColors.Desktop;
            this.label5.ForeColor = Color.Transparent;
            this.label5.Location = new Point(29, 175);
            this.label5.Name = "label5";
            this.label5.Size = new Size(245, 12);
            this.label5.TabIndex = 23;
            this.label5.Text = "适用系统:Windows7 以上系统 具备无线网卡";
            this.label7.AutoSize = true;
            this.label7.BackColor = SystemColors.Desktop;
            this.label7.ForeColor = Color.Transparent;
            this.label7.Location = new Point(29, 219);
            this.label7.Name = "label7";
            this.label7.Size = new Size(173, 12);
            this.label7.TabIndex = 24;
            this.label7.Text = "精简核心代码优化提升响应速度";
            this.label8.AutoSize = true;
            this.label8.BackColor = SystemColors.Desktop;
            this.label8.Cursor = Cursors.Hand;
            this.label8.Font = new Font("宋体", 9f, FontStyle.Underline, GraphicsUnit.Point, 134);
            this.label8.ForeColor = Color.Transparent;
            this.label8.Location = new Point(131, 241);
            this.label8.Name = "label8";
            this.label8.Size = new Size(71, 12);
            this.label8.TabIndex = 25;
            this.label8.Text = "FAQ帮助指南";
            this.label8.Click  = new EventHandler(this.label8_Click);
            this.label9.AutoSize = true;
            this.label9.BackColor = SystemColors.Desktop;
            this.label9.Cursor = Cursors.Hand;
            this.label9.Font = new Font("宋体", 9f, FontStyle.Underline, GraphicsUnit.Point, 134);
            this.label9.ForeColor = Color.Transparent;
            this.label9.Location = new Point(219, 241);
            this.label9.Name = "label9";
            this.label9.Size = new Size(53, 12);
            this.label9.TabIndex = 26;
            this.label9.Text = "检查更新";
            this.label9.Click  = new EventHandler(this.label9_Click);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(284, 262);
            base.Controls.Add(this.label9);
            base.Controls.Add(this.label8);
            base.Controls.Add(this.label7);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.Online);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.comboBox1);
            base.Controls.Add(this.label6);
            base.Controls.Add(this.button2);
            base.Controls.Add(this.textBox_key);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.textBox_name);
            base.Controls.Add(this.button1);
            base.FormBorderStyle = FormBorderStyle.FixedDialog;
            base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.Name = "Form1";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Wi-Fi热点 Ver2.1";
            base.TopMost = true;
            base.Resize  = new EventHandler(this.Main_Resize);
            this.contextMenuStrip1.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}


实例下载地址

wifi客户端连接(一键共享WiFi上网)源码

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警