我在复制“ WiFi状态”时制作一个程序。我收到一个包含ssid和奇异强度的Windows通知。现在,我也想选择获取WiFi密码,但是我不知道该怎么做。有人可以帮我吗?
这是我的代码:
if (clipboardText == "wifi status")
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = "netsh.exe";
p.StartInfo.Arguments = "wlan show interfaces";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string s = p.StandardOutput.ReadToEnd();
string s1 = s.Substring(s.IndexOf("SSID"));
s1 = s1.Substring(s1.IndexOf(":"));
s1 = s1.Substring(2, s1.IndexOf("\n")).Trim();
string s2 = s.Substring(s.IndexOf("Signal"));
s2 = s2.Substring(s2.IndexOf(":"));
s2 = s2.Substring(2, s2.IndexOf("\n")).Trim();
{
notifyIcon1.Icon = SystemIcons.Exclamation;
notifyIcon1.BalloonTipTitle = "";
notifyIcon1.BalloonTipText = "WIFI verbonden met " + s1 + " " + "Signaal sterkte " + s2;
notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
notifyIcon1.ShowBalloonTip(1000);
}
}