当前位置: 首页>>代码示例>>Python>>正文


Python win32service.StartService方法代码示例

本文整理汇总了Python中win32service.StartService方法的典型用法代码示例。如果您正苦于以下问题:Python win32service.StartService方法的具体用法?Python win32service.StartService怎么用?Python win32service.StartService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32service的用法示例。


在下文中一共展示了win32service.StartService方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StartService

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import StartService [as 别名]
def StartService(serviceName, args = None, machine = None):
    hscm = win32service.OpenSCManager(machine,None,win32service.SC_MANAGER_ALL_ACCESS)
    try:

        hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS)
        try:
            win32service.StartService(hs, args)
        finally:
            win32service.CloseServiceHandle(hs)
    finally:
        win32service.CloseServiceHandle(hscm) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:win32serviceutil.py

示例2: OnStartCmd

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import StartService [as 别名]
def OnStartCmd(self, id, code):
		service = self.GetSelService()
		if not service:
			return
		s = win32service.OpenService(self.scm, service[1], win32service.SERVICE_ALL_ACCESS)
		win32service.StartService(s, None)
		win32service.CloseServiceHandle(s)
		self.ReloadData() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:ControlService.py

示例3: start_service

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import StartService [as 别名]
def start_service(self, service_name):
        LOG.debug('Starting service %s', service_name)
        with self._get_service_handle(
                service_name, win32service.SERVICE_START) as hs:
            win32service.StartService(hs, service_name) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:7,代码来源:windows.py

示例4: start_service

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import StartService [as 别名]
def start_service(h_svc, logger):
    """Starts the winpmem service"""
    # Make sure the service is stopped.
    try:
        win32service.ControlService(h_svc, win32service.SERVICE_CONTROL_STOP)
    except win32service.error:
        pass

    try:
        win32service.StartService(h_svc, [])
    except win32service.error, e:
        logger.error(str(e) + ": will try to continue") 
开发者ID:SekoiaLab,项目名称:Fastir_Collector,代码行数:14,代码来源:utils.py

示例5: StartService

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import StartService [as 别名]
def StartService(service):
 	  try:
 	      win32service.StartService(service, None)
 	      status = win32service.QueryServiceStatus(service)[1]
 	      while (status == win32service.SERVICE_START_PENDING):
 	          time.sleep(1)
 	          status = win32service.QueryServiceStatus(service)[1]
 	      return status == win32service.SERVICE_RUNNING
 	  except:
 	      return False 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:12,代码来源:__init__.py

示例6: Connect

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import StartService [as 别名]
def Connect(self):
        """
        This function tries to connect to the named pipe from AlternateMceIrService.  If it can't connect, it will periodically
        retry until the plugin is stopped or the connection is made.
        """
        self.connecting = True
        #eg.PrintNotice("MCE_Vista: Connect started")
        while self.file is None and self.keepRunning:
            self.SetReceiving(False)
            try:
                self.file = win32file.CreateFile(r'\\.\pipe\MceIr',win32file.GENERIC_READ
                                        |win32file.GENERIC_WRITE,0,None,
                                        win32file.OPEN_EXISTING,win32file.FILE_ATTRIBUTE_NORMAL
                                        |win32file.FILE_FLAG_OVERLAPPED,None)
                if self.sentMessageOnce:
                    eg.PrintNotice("MCE_Vista: Connected to MceIr pipe, started handling IR events")
                    self.plugin.TriggerEvent("Connected")
                    self.sentMessageOnce = False
            except:
                if not self.sentMessageOnce:
                    eg.PrintNotice("MCE_Vista: MceIr pipe is not available, app doesn't seem to be running")
                    eg.PrintNotice("    Will continue to try to connect to MceIr")
                    eg.PrintNotice("    Message = %s"%win32api.FormatMessage(win32api.GetLastError()))
                    self.plugin.TriggerEvent("Disconnected")
                    self.sentMessageOnce = True

                #if self.service and IsServiceStopped(self.service):
                #    eg.PrintNotice("MCE_Vista: MceIr service is stopped, trying to start it...")
                #    StartService(self.service)

                time.sleep(1)
        self.connecting = False
        return 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:35,代码来源:__init__.py


注:本文中的win32service.StartService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。