def instance_running(self):
'''
Use CreateEvent to make sure there is only one instance running
'''
if self.SICHECK_EVENT is None:
self.SICHECK_EVENT = win32event.CreateEvent(
None, 1, 0, self.GUID
)
# An instance is already running, quit
if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
win32gui.MessageBox(
self.HWND,
'You can only run one instance at a time',
'Seems like KeyCounter is already running',
win32con.MB_OK
)
return self.stop()
评论列表
文章目录