HelpDesk-日志篇[后续]
上次在《HelpDesk-日志篇》里面提到了写一个查询日志的小工具,来代替过长的URL输入。
恩,写一个技术演示版本的代码吧,超级简单的:
using System;
using System.Diagnostics;
namespace EQhelperTechDemo
{
///
/// EQHelper 技术实现版本
///
class MainClass
{
private string eventid=string.Empty;
private string source=string.Empty;
///
/// 应用程序的主入口点。
///
[STAThread]
static void Main(string[] args)
{
MainClass mc= new MainClass();
Console.WriteLine("Welcome to Event Query Tools");
Console.WriteLine("日志ID:");
mc.eventid= Console.ReadLine();
Console.WriteLine("来源:");
mc.source=Console.ReadLine();
mc.OpenWithStartInfo();
}
///
/// Uses the ProcessStartInfo class to start new processes, both in a Normal
/// mode.
///
public void OpenWithStartInfo()
{
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.Arguments = "http://www.microsoft.com/products/ee/transform.aspx?ProdName=Windows%20Operating%20System&ProdVer=5.1.2600.2180&EvtID="+eventid+"&EvtSrc="+source+"&LCID=";
Process.Start(startInfo);
}
}
}
其实就是利用Process类,打开了一个含有默认URL的IE。大家用CSC编译一次就成了。
BTW,如果ITECN能提供下载的小空间就好啦~~~
另外,关于工具,比如Source那里,因为Windows的事件来源都是固定的,所以可以用下拉菜单来做,呵呵,大家如果感兴趣的,自己可以试试。