Last few days I had a firewall issue in my desktop that made web browsing irregular. It was a peculiar problem, I was able to browse few sites like Google, Vishwak.COM but not others. I had to keep running the same diagnostic commands many times to take values to be sent to my support team. Finally I ended up writing this handy tool that copies to clipboard diagnostic informations from IPConfig, Tracert, Ping & WebGet commands. This information can be used for further investigation or email to support. I also added features to FlushDNS, Renew IP & Turn Auto Tuning (Vista and Windows Server 2008) OFF/ON.

diagnose tool screenshot

While developing the tool over two half-a-days I learnt quite a few APIs and a bit of C# coding. This included how to call a console command like IPCONFIG /ALL and capture the output to a string from a C# application, get the Internet Explorer Proxy settings, Call Network Properties applet, create an install with VS 2008 & how to paste a code snippet in WLW.

   1: private string DoConsoleAndCapture(string sInput)
   2: {
   3:  
   4: string sOutput = "";
   5: ProcessStartInfo pi = new ProcessStartInfo("cmd.exe", "/c " + sInput );
   6: pi.WindowStyle = ProcessWindowStyle.Minimized; 
   7: pi.RedirectStandardOutput = true;
   8: pi.UseShellExecute = false;
   9: Process p = Process.Start(pi);
  10: p.WaitForExit();
  11: //p.Start();
  12: TextReader t = p.StandardOutput;
  13: sOutput = t.ReadToEnd();
  14: t.Close();            
  15: p.Close();
  16:  
  17: return sOutput; 
  18: }

The experience of using Visual Studio 2008 was interesting as it has been few years since I coded something end to end. I wish the coding surface to become more intelligent in terms of offering help on discovering commands and APIs that the developer is looking for. When VB6 came a decade or so back the help feature that it had was revolutionary and the wealth of information MSDN provided was without par in the industry. Now with Web & Internet Search prevalent the present IDE calls for a complete rethinking and revamp – unfortunately I don’t feel the tools have come there yet. What I am talking here is not about wizards, smart tags or even intellisense but about how the tool helps a developer to learn/discover necessary APIs/solve the problem at hand.

Categorized in:

Tagged in: