[ WhoSLocking | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
Back to the top of CServiceManager
This class enhanced remote control functions for Windows NT Services.
Back to the top of CServiceManager
To use this class:
Note: By default, this class prints log/error messages in stdout. To change this behavior, you must derive this class and override functions Print() and PrintServiceInfo() with your own in the derived class.
Back to the top of CServiceManager
CServiceManager oServiceManager;CString szMyRemoteMachine = "\\\\remotename"; CString szMyServiceName = "MyService";
if (oServiceManager.OpenService(szMyRemoteMachine, szMyServiceName)) { if (oServiceManager.StartService(NULL, // Use currently opened machine NULL, // Use currently opened service TRUE // Start dependent services )) {
cout << "Service started!\n";
} else {
cerr << "Cannot start service " << szMyServiceName << " on host " << szMyRemoteMachine << "\n";
} } else {
cerr << "Cannot connect to service " << szMyServiceName << " on host " << szMyRemoteMachine << "\n";
}
Back to the top of CServiceManager
Author Emmanuel KARTMANN
Date Monday 12/6/99
Back to the top of CServiceManager
Back to the top of CServiceManager
Purpose: create an instance of the class
Parameters: none (C++ constructor)
Return value : none (C++ constructor)
Description :
CServiceManager();
Back to the top of CServiceManager
Purpose: delete an instance of the class
Parameters: none (C++ destructor)
Return value : none (C++ destructor)
Description :
virtual ~CServiceManager();
Back to the top of CServiceManager
BOOL Open(LPCTSTR lpszMachineName, LPCTSTR lpszServiceName);
Purpose: open a service (possibly remote)
Parameters:
Description :
BOOL Open(LPCTSTR lpszMachineName, LPCTSTR lpszServiceName);
Back to the top of CServiceManager
BOOL StartService(LPCTSTR lpszMachineName , LPCTSTR lpszServiceName , BOOL bStartDependents );
Purpose: start a service (possibly remote)
Parameters:
Description : If any of the parameters are NULL, this function reuses the currently open SCM/Service.
BOOL StartService(LPCTSTR lpszMachineName = NULL, LPCTSTR lpszServiceName = NULL, BOOL bStartDependents = FALSE);
Back to the top of CServiceManager
BOOL StopService(LPCTSTR lpszMachineName , LPCTSTR lpszServiceName , BOOL bStopDependents );
Purpose: stop a service (possibly remote)
Parameters:
Description : If any of the parameters are NULL, this function reuses the currently open SCM/Service.
BOOL StopService(LPCTSTR lpszMachineName = NULL, LPCTSTR lpszServiceName = NULL, BOOL bStopDependents = FALSE);
Back to the top of CServiceManager
BOOL QueryService(LPCTSTR lpszMachineName , LPCTSTR lpszServiceName );
Purpose: fetch service information (possibly remote)
Parameters:
Description : If any of the parameters are NULL, this function reuses the currently open SCM/Service.
BOOL QueryService(LPCTSTR lpszMachineName = NULL, LPCTSTR lpszServiceName = NULL);
Back to the top of CServiceManager
BOOL ListServices(LPCTSTR lpszMachineName );
Purpose: list the services installed on a machine (possibly remote)
Parameters:
Description : If the parameter is NULL, this function reuses the currently open SCM.
BOOL ListServices(LPCTSTR lpszMachineName = NULL);
Back to the top of CServiceManager
Purpose:
Parameters:
Description : Derive this class and override this function if you don't want to print data in stdout.
virtual BOOL PrintServiceInfo(int nCount, SERVICE_STATUS *ServiceStatus, LPCTSTR lpszServiceName, LPCTSTR lpszDisplayName, LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL);
Back to the top of CServiceManager
BOOL OpenServiceControlManager(LPCTSTR lpszMachineName );
Purpose: open SCM on a machine (possibly remote)
Parameters:
Description :
BOOL OpenServiceControlManager(LPCTSTR lpszMachineName = NULL);
Back to the top of CServiceManager
BOOL OpenService(LPCTSTR lpszServiceName );
Purpose: open a service on a machine
Parameters:
Description :
BOOL OpenService(LPCTSTR lpszServiceName = NULL);
Back to the top of CServiceManager
Back to the top of CServiceManager
Back to the top of CServiceManager
Back to the top of CServiceManager
Report problems to jkotula@stratasys.com