下面的文章提供了访问NT中所有Service的功能,每次列举Services时,函数会返回一个列表。 列表的内容依赖于你所使用的参数。 (我认为这是一种很巧妙的编程方法,它极大的减轻了数据和函数的冗余,利用一个STATIC函数来产生本身对象的列表或者是来产生对象)
Class declaration:声明
class TTrixServiceInfo {
public:
CString ServiceName;
CString DisplayName;
CString BinaryPath;
DWORD ServiceType;
DWORD StartType;
DWORD ErrorControl;
DWORD CurrentState;
public:
TTrixServiceInfo();
TTrixServiceInfo& operator=(const TTrixServiceInfo& source);
CString GetServiceType(void);
CString GetStartType(void);
CString GetErrorControl(void);
CString GetCurrentState(void);
static TTrixServiceInfo *EnumServices(DWORD serviceType,
DWORD serviceState,DWORD *count);
};
Description:类的每一个实例都包含了SERVICE的各种信息,如果想得到SERVICE的列表,请调用TTrixServiceInfo::EnumServices(...)。
参数ServiceType的取值可能是:SERVICE_WIN32 and SERVICE_DRIVER.
参数ServiceState的取值可能是:SERVICE_ACTIVE and SERVICE_INACTIVE.
EnumServices(...)将返回TTrixServiceInfo对象的列表,(如果出错返回NULL)。列表中对象的个数可以通过参数返回时得到。 <  
说明:本教程来源互联网或网友上传或出版商,仅为学习研究或媒体推广,wanshiok.com不保证资料的完整性。
1/2 1 2 下一页 尾页 |