using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace wifiGX
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public int wifikg = 0;
private void Form1_Load(object sender, EventArgs e)
{
}
//cmd调用
private string InvokeCmd(string cmdArgs)
{
string Tstr = "";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(cmdArgs);
p.StandardInput.WriteLine("exit");
Tstr = p.StandardOutput.ReadToEnd();
p.Close();
return Tstr;
}
private void button1_Click(object sender, EventArgs e)
{
if (okmima == 1 && okmingzi == 1)
{
try
{
string mingling = "netsh wlan set hostednetwork mode=allow ssid=" + mingzi.Text + " key=" + mima.Text;
string str = InvokeCmd(mingling);
richTextBox1.Text = str;
int cg = 0;
for (int i = 0; i < str.Length - 2; i++)
C#-WiFi共享
最新推荐文章于 2025-05-07 16:13:16 发布