Class WindowsServiceManager

This class handles installation of a Windows Service as well as providing the ability to start stop and detect the state of a Windows Service. Utilizes P/Invoke calls to install the service.

System.Object
  Westwind.WebMonitor.Components.WindowsServiceManager
public class WindowsServiceManager : object

Class Members

MemberDescription

Constructor

CloseServiceHandle

public static void CloseServiceHandle( IntPtr SCHANDLE );

CreateService

public static IntPtr CreateService( IntPtr SC_HANDLE,
    string lpSvcName,
    string lpDisplayName,
    int dwDesiredAccess,
    int dwServiceType,
    int dwStartType,
    int dwErrorControl,
    string lpPathName,
    string lpLoadOrderGroup,
    int lpdwTagId,
    string lpDependencies,
    string lpServiceStartName,
    string lpPassword );

DeleteService

public static int DeleteService( IntPtr SVHANDLE );

GetLastError

public static int GetLastError();

InstallService

This method installs and runs the service in the service conrol manager.

public bool InstallService( string svcPath,
    string svcName,
    string svcDispName );

IsServiceInstalled

Determines whether a service exisits. Pass in the Service Name either by the ServiceName or the descriptive name

public bool IsServiceInstalled( string ServiceName );

IsServiceRunning

public bool IsServiceRunning( string ServiceName );

OpenSCManager

public static IntPtr OpenSCManager( string lpMachineName,
    string lpSCDB,
    int scParameter );

OpenService

public static IntPtr OpenService( IntPtr SCHANDLE,
    string lpSvcName,
    int dwNumServiceArgs );

StartService

public static int StartService( IntPtr SVHANDLE,
    int dwNumServiceArgs,
    string lpServiceArgVectors );

public bool StartService( string ServiceName );

StopService

Stops a service by name or descriptive name

public bool StopService( string ServiceName );

UnInstallService

This method uninstalls the service from the service conrol manager.

public bool UnInstallService( string svcName );

Requirements

Namespace: Westwind.WebMonitor.Components
Assembly: webmonitorcomponents.dll

© West Wind Technologies, 2018 • Updated: 12/28/06
Comment or report problem with topic