手功,管理工具-->服务编程方式访问,方法也很多,以前我推荐过使用WMI来访问服务(其实是半年前我就发过了)SELECT * FROM Win32_ServiceService Control控件介绍:
该控件要用到一个新的查询字"SELECT * FROM Win32_Service",通过它我们就可以
得到系统中有那些服务存在.为了方便启动和终止一项服务我们可以在ListView中.....具体文章参考:http://www.csdn.net/develop/read_article.asp?id=15346
该控件要用到一个新的查询字"SELECT * FROM Win32_Service",通过它我们就可以
得到系统中有那些服务存在.为了方便启动和终止一项服务我们可以在ListView中.....具体文章参考:http://www.csdn.net/develop/read_article.asp?id=15346
最好是监控程序一启动,就能接收到这个Service的一些事件。
{
boolean AcceptPause ;
boolean AcceptStop ;
string Caption ;
uint32 CheckPoint ;
string CreationClassName ;
string Description ;
boolean DesktopInteract ;
string DisplayName ;
string ErrorControl ;
uint32 ExitCode ;
datetime InstallDate ;
string Name ;
string PathName ;
uint32 ProcessId ;
uint32 ServiceSpecificExitCode ;
string ServiceType ;
boolean Started ;
string StartMode ;
string StartName ;
string State ;
string Status ;
string SystemCreationClassName ;
string SystemName ;
uint32 TagId ;
uint32 WaitHint ;
};
而且还有相关的处理方式参考:ms-help://MS.VSCC/MS.MSDNVS.2052/wmisdk/r_32os5_4dyd.htm你把我上面的代码扩充一下,就可以了..
我去试试先。