大网数据广告活动
域与目录服务

IADsServiceOperations Property Methods (Iads.h)

· 52CE 我爱测

The property methods of the IADsServiceOperations interface read and write the properties described in the following list. For more information about property methods, see Interface Property Methods.

The property methods of the IADsServiceOperations interface read and write the properties described in the following list. For more information about property methods, see Interface Property Methods.

Properties

Status

Status of service.

The following are possible values.

ADS_SERVICE_STOPPED (0x00000001)

ADS_SERVICE_START_PENDING (0x00000002)

ADS_SERVICE_STOP_PENDING (0x00000003)

ADS_SERVICE_RUNNING (0x00000004)

ADS_SERVICE_CONTINUE_PENDING (0x00000005)

ADS_SERVICE_PAUSE_PENDING (0x00000006)

ADS_SERVICE_PAUSED (0x00000007)

ADS_SERVICE_ERROR (0x00000008)

ADS_SERVICE_OWN_PROCESS (0x00000010)

ADS_SERVICE_SHARE_PROCESS (0x00000020)

ADS_SERVICE_KERNEL_DRIVER (0x00000001)

ADS_SERVICE_FILE_SYSTEM_DRIVER (0x00000002)

ADS_SERVICE_BOOT_START (SERVICE_BOOT_START)

ADS_SERVICE_SYSTEM_START (SERVICE_SYSTEM_START)

ADS_SERVICE_AUTO_START (SERVICE_AUTO_START)

ADS_SERVICE_DEMAND_START (SERVICE_DEMAND_START)

ADS_SERVICE_DISABLED (SERVICE_DISABLED)

ADS_SERVICE_ERROR_IGNORE (0)

ADS_SERVICE_ERROR_NORMAL (1)

ADS_SERVICE_ERROR_SEVERE (2)

ADS_SERVICE_ERROR_CRITICAL (3)

Access type: Read-only

Scripting data type: LONG

// C++ method syntax
HRESULT get_Status(
  [out] LONG* pstatus
);

Examples

The following code example shows how to verify the status of a Microsoft Fax Service running on Windows 2000.

Dim cp As IADsComputer
Dim sr As IADsService
Dim so As IADsServiceOperations
On Error GoTo Cleanup

Set cp = GetObject("WinNT://myMachine,computer")
Set sr = cp.GetObject("Service", "Fax")
Set so = sr

Select Case so.Status
    Case ADS_SERVICE_STOPPED
        MsgBox "Microsoft Fax Service has stopped."
    Case ADS_SERVICE_RUNNING
        MsgBox "Microsoft Fax Service is running."
    Case ADS_SERVICE_PAUSED
        MsgBox "Microsoft Fax Service has paused."
    Case ADS_SERVICE_ERROR
        MsgBox "Microsoft Fax Service has errors."
End Select

Cleanup:
    If (Err.Number<>0) Then
        MsgBox("An error has occurred. " & Err.Number)
    End If
    Set cp = Nothing
    Set sr = Nothing
    Set so = Nothing

The following code example verifies the status of a Microsoft Fax Service running on Windows 2000.

IADsContainer *pCont = NULL;
IADsServiceOperations *pSrvOp = NULL;
LPWSTR adsPath = L"WinNT://myMachine,computer";
IDispatch *pDisp = NULL;
long status = 0;

HRESULT hr = S_OK;

hr = ADsGetObject(adsPath,IID_IADsContainer,(void**)&pCont);
if(FAILED(hr)) {goto Cleanup;}

hr = pCont->GetObject(CComBSTR("Service"), CComBSTR("Fax"), &pDisp);
if(FAILED(hr)) {goto Cleanup;}

hr = pDisp->QueryInterface(IID_IADsServiceOperations,(void**)&pSrvOp);
if(FAILED(hr)) {goto Cleanup;}

hr = pSrvOp->get_Status(&status);
switch (status) 
{
    case ADS_SERVICE_STOPPED:
        printf("The service has stopped.\n");
        break;
    case ADS_SERVICE_RUNNING:
        printf("The service is running.\n");
        break;
    case ADS_SERVICE_PAUSED:
        printf("The service has paused.\n");
        break;
    case ADS_SERVICE_ERROR:
        printf("The service has errors.\n");
        break;
}

Cleanup:
    if(pDisp) pDisp->Release();
    if(pCont) pCont->Release();
    if(pSrvOp) pSrvOp->Release();

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header Iads.h
DLL Activeds.dll
IID IID_IADsServiceOperations is defined as 5D7B33F0-31CA-11CF-A98A-00AA006BC149

See also

IADsFileService

IADsFileServiceOperations

IADsService

IADsServiceOperations

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。