IADsServiceOperations::Pause method

The IADsServiceOperations::Pause method pauses a service started with the IADsServiceOperations::Start method.

Syntax


HRESULT Pause();

Parameters

This method has no parameters.

Return value

This method supports the standard return values, including S_OK. For more information about other return values, see ADSI Error Codes.

Examples

The following code example shows how to pause a Microsoft Fax Service running on Windows 2000.


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

Set cp = GetObject("WinNT://myMachine,computer")
Set so = cp.GetObject("Service", "Fax")
If (so.Status = ADS_SERVICE_RUNNING) Then ' The operation is running.
    so.Pause
End If

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


The following code example resumes a Microsoft Fax Service running on Windows 2000.


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

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;}

long status;
hr = pSrvOp->get_Status(&status);
if(FAILED(hr)) {goto Cleanup;}
if(status == ADS_SERVICE_RUNNING) pSrvOp->Pause();

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

Requirements

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

IADsServiceOperations
IADsService
IADsServiceOperations::Start

 

 

Show: