|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionI recently got a new notebook and was routinely transferring all of my old, favourite utilities to it when I found that NetStumbler would not work with Vista. I saw some references to a poor-man's version with the following command line: netsh wlan show networks mode=bssid
I decided to put it in a window, so here is my effort. For Microsoft documentation on The codeA timer on the Form calls the Process proc = new Process();
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = "netsh";
proc.StartInfo.Arguments = "wlan show networks mode=bssid";
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();
output = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
The output is then parsed line-by-line to build an array of currently active networks. This is presented in a ListViewItem SearchItem = new ListViewItem();
SearchItem = listView1.FindItemWithText(Networks[i, 0]);
if (SearchItem == null)
{
// New discovery - add it to the list
Any networks already in the int SignalInt = Convert.ToInt32(Networks[i, 3].TrimEnd(' ').TrimEnd('%'));
if (SignalInt > 50) listView1.Items[listView1.Items.Count-1].ImageIndex = 0;
else . . .
The coloured icons represent the signal levels as:
Points of interestOne annoyance with the class ListViewNF : System.Windows.Forms.ListView
{
public ListViewNF()
{
//Activate double buffering
this.SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint, true);
//Enable the OnNotifyMessage event so we get a chance to filter out
// Windows messages before they get to the Form's WndProc
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
}
protected override void OnNotifyMessage(Message m)
{
//Filter out the WM_ERASEBKGND message
if (m.Msg != 0x14)
{
base.OnNotifyMessage(m);
}
}
Known issuesThe History
|
||||||||||||||||||||||