請問如何用編程得到xp某個服務的啟動類型是什麼?是自動,手動,還是已停用?
ServiceControlManager := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
ServiceHandle:= OpenService(ServiceControlManager, pchar('Alerter'), SERVICE_CHANGE_CONFIG);
......... //?
........... //?
ServiceControlManager := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
ServiceHandle:= OpenService(ServiceControlManager, pchar('Alerter'), SERVICE_CHANGE_CONFIG);
......... //?
........... //?
解决方案 »
- Merry Christmas
- 请教下,多文档窗体动态创建显示问题
- 关于图形裁切并且保存为文件的问题
- 一个简单问题
- 请教各位大侠一个TDateTimePicker的问题,假如界面上显示为2005-05,我想在程序中得到这个时间的上一个月和下一个月,怎么做?
- 全屏显示问题:使form中的控件(如Edit、StringGrid)随form大小的变化而变化?
- 怎么样发送Html邮件
- 用delphi编制短消息程序
- 我要哭了,在网上找了半天都见不到Tmediaplayer的控件
- FK?
- DBGridEh的键盘事件问题
- 自己编写的组件中定义的变量 FFilter:string,怎样才能和TFilterComBoBox.Filter的类型一致?
相關Api:1, QueryServiceConfigThe QueryServiceConfig function retrieves the configuration parameters of the specified service. Optional configuration parameters are available using the QueryServiceConfig2 function.
BOOL QueryServiceConfig(
SC_HANDLE hService,
LPQUERY_SERVICE_CONFIG lpServiceConfig,
DWORD cbBufSize,
LPDWORD pcbBytesNeeded
);2,QueryServiceStatusThe QueryServiceStatus function retrieves the current status of the specified service.This function has been superseded by the QueryServiceStatusEx function. QueryServiceStatusEx returns the same information QueryServiceStatus returns, with the addition of the process identifier and additional information for the service.
BOOL QueryServiceStatus(
SC_HANDLE hService,
LPSERVICE_STATUS lpServiceStatus
);
PENUM_SERVICE_STATUS = ^ENUM_SERVICE_STATUS;
ENUM_SERVICE_STATUS = packed record
lpServiceName: PCHAR;
lpDisplayName: PCHAR;
ServiceStatus: SERVICE_STATUS;
end; PQUERY_SERVICE_CONFIG = ^QUERY_SERVICE_CONFIG;
QUERY_SERVICE_CONFIG = packed record
dwServiceType: DWORD;
dwStartType: DWORD;
dwErrorControl: DWORD;
lpBinaryPathName: PCHAR;
lpLoadOrderGroup: PCHAR;
dwTagId: DWORD;
lpDependencies: PCHAR;
lpServiceStartName: PCHAR;
lpDisplayName: PCHAR;
end;implementationfunction EnumServicesStatus(
const hSCManager: DWORD;
const dwServiceType: DWORD;
const dwServiceState: DWORD;
const lpServices: PENUM_SERVICE_STATUS;
const cbBufSize: DWORD;
const pcbBytesNeeded: PDWORD;
const lpServicesReturned: PDWORD;
const lpResumeHandle: PDWORD
): Longbool; stdcall; external 'advapi32.dll' name 'EnumServicesStatusA';function QueryServiceConfig(
const hService: DWORD;
const lpServiceConfig: PQUERY_SERVICE_CONFIG;
const cbBufSize: DWORD;
const pcbBytesNeeded: PDWORD
): Longbool; stdcall; external 'advapi32.dll' name 'QueryServiceConfigA';