示例#1
0
 private static void StopService(IntPtr hService)
 {
     ServiceInstaller.ControlService(hService, ServiceControl.Stop, new ServiceInstaller.SERVICE_STATUS());
     ServiceInstaller.WaitForServiceStatus(hService, ServiceState.Stopping, ServiceState.Stop);
 }
示例#2
0
 private static void StartService(IntPtr hService)
 {
     ServiceInstaller.SERVICE_STATUS sERVICESTATU = new ServiceInstaller.SERVICE_STATUS();
     ServiceInstaller.StartService(hService, 0, 0);
     ServiceInstaller.WaitForServiceStatus(hService, ServiceState.Starting, ServiceState.Run);
 }