2006年03月28日 星期二 10:16
python-chinese,您好! here's the code: class SmallestPythonService(win32serviceutil.ServiceFramework): _svc_name_ = "PythonService01" _svc_display_name_ = "Python Service01" def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) # Create an event which we will use to wait on. # The "service stop" request will set this event. self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): # Before we do anything, tell the SCM we are starting the stop process. self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) print self.ReportServiceStatus # And set my event. win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): # We do nothing other than wait to be stopped! win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) myServer = Server( 61005 ).run() 关于这里的self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)"and self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) 是什么意思呢? ReportServiceStatus()是什么呢? python python at sealonline.com.cn 2006-03-28
Zeuux © 2025
京ICP备05028076号