Saturday, April 26, 2014

Virtual WiFi

This program can only be applied to PC, Netbook or Notebook with WiFi adapter attached to it. For example, you can detect WiFi signal then you can use this program. The signal emitted by this program is not like an Ad Hoc but rather a Router like your WiFi Router. The signal can be available on Smartphone that Ad Hoc cannot.


Down here is the video

Download Source Code: Virtual Wireless Router.rar
Codes down here



using System.Diagnostics;

Process newprocess = new Process();

        public Form1()
        {
            InitializeComponent();
            newprocess.StartInfo.UseShellExecute = false;
            newprocess.StartInfo.CreateNoWindow = true;
            newprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            newprocess.StartInfo.FileName = "netsh";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "Start")
            {
                if (SSID.Text.Length > 0 && Password.Text.Length > 0)
                {
                    progressBar1.Visible = true;
                    progressBar1.Increment(25);
                    Method();
                    button1.Text = "Stop";
                }
                else
                {
                    MessageBox.Show("No SSID/password","Error");
                }
            }
            else
            {
                progressBar1.Visible = true;
                progressBar1.Increment(50);
                newprocess.StartInfo.Arguments = "wlan stop hostednetwork";
                using (Process exeProcess = Process.Start(newprocess.StartInfo))
                {
                    exeProcess.WaitForExit();
                    progressBar1.Increment(100);
                    button1.Text = "Start";
                    SSID.Enabled = true;
                    Password.Enabled = true;
                    progressBar1.Visible = false;
                }
            }
        }

//Methods

        private void Method()
        {
            newprocess.StartInfo.Arguments = "wlan stop hostednetwork";
            using (Process exeProcess = Process.Start(newprocess.StartInfo))
            {
                exeProcess.WaitForExit();
                progressBar1.Increment(25);
                Method1();
            }
        }

        private void Method1()
        {
            newprocess.StartInfo.Arguments = "wlan set hostednetwork mode=allow ssid="+SSID.Text+" key="+Password.Text;
            using (Process exeProcess = Process.Start(newprocess.StartInfo))
                {
                    exeProcess.WaitForExit();
                    progressBar1.Increment(25);
                    Method2();
                }
        }
        private void Method2()
        {
            newprocess.StartInfo.Arguments = "wlan start hostednetwork";
            using (Process exeProcess = Process.Start(newprocess.StartInfo))
            {
                exeProcess.WaitForExit();
                SSID.Enabled = false;
                Password.Enabled = false;
                progressBar1.Increment(25);
                progressBar1.Visible = false;
            }
        }

No comments:

Post a Comment