Group: Service - Library: advapi32
The OpenSCManager function establishes a connection to the service control manager on the specified computer and opens the specified service control manager database.
Encapsulating access to the Windows Services in a class
How to create a service object
How to delete a service object
SC_HANDLE OpenSCManager(
LPCTSTR lpMachineName,
LPCTSTR lpDatabaseName,
DWORD dwDesiredAccess
);
DECLARE INTEGER OpenSCManager IN advapi32;
STRING lpMachineName,;
STRING lpDatabaseName,;
LONG dwDesiredAccess
lpMachineName [in] Pointer to a null-terminated string that specifies the name of the target computer.
lpDatabaseName [in] Pointer to a null-terminated string that specifies the name of the service control manager database to open.
dwDesiredAccess [in] Access to the service control manager.
If the function succeeds, the return value is a handle to the specified service control manager database.
The returned handle is only valid for the process that called the OpenSCManager function. It can be closed by calling the CloseServiceHandle function.