def OnCmdHelpContents(self): HtmlHelp( GetDesktopWindow(), join(eg.mainDir, "EventGhost.chm"), HH_DISPLAY_TOPIC, 0 )
def Setup( self, plugin, waitTime, pollTime, useDefaultPollTime, initTime = 15.0, checkRepeatFlag = False, repeatReleaseTime = 200 ): """ This will be called inside the thread at the beginning. """ self.lock = Lock() self.abort = False self.plugin = plugin self.waitTime = float(waitTime)/1000.0 self.repeatReleaseTime = float(repeatReleaseTime)/1000.0 self.pollTime = pollTime self.useDefaultPollTime = useDefaultPollTime self.defaultPollTime = -1 self.LastKeyCode = -1 self.checkRepeatFlag = checkRepeatFlag self.repeatCode = c_int(0) self.systemCode = c_int(0) self.keyCode = c_int(0) self.lastEvent = eg.EventGhostEvent() self.keyStillPressed = False self.initTerminated = False self.timerInit = None self.timerKey = None self.hwnd = None self.dll = None # load irremote.dll try: regHandle = _winreg.OpenKey( _winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Hauppauge WinTV Infrared Remote', 0, _winreg.KEY_READ ) InstallString = _winreg.QueryValueEx(regHandle, 'UninstallString')[0] _winreg.CloseKey( regHandle ) irremoteDir = InstallString.partition(' ')[0].rsplit('\\',1)[0] dllPath = os.path.join(irremoteDir, "irremote.DLL") self.dll = windll.LoadLibrary(dllPath) self.dll = WinDLL(dllPath) except: plugin.PrintError("Couldn't find irremote.dll! Reinstalling the Hauppauge " "WinTV Infrared Remote package can solve the problem." ) raise self.plugin.Exceptions.DeviceNotFound self.IR_Open = WINFUNCTYPE( c_int, HWND, c_int, c_byte, c_int ) self.IR_Close = WINFUNCTYPE( c_int, HWND, c_int ) self.IR_GetSystemKeyCode = WINFUNCTYPE( c_int, POINTER( c_int), POINTER( c_int), POINTER( c_int) ) self.TIMERPROC = WINFUNCTYPE( None, HWND, c_uint, c_uint, DWORD ) self.IR_Open = self.dll.IR_Open self.IR_Close = self.dll.IR_Close self.IR_GetSystemKeyCode = self.dll.IR_GetSystemKeyCode wc = WNDCLASS() wc.hInstance = GetDesktopWindow() wc.lpszClassName = "HaupPluginEventSinkWndClass" wc.lpfnWndProc = WNDPROC(self.MyWndProc) if not RegisterClass(byref(wc)): raise WinError() self.hwnd = CreateWindow( wc.lpszClassName, "HaupaugePlugin Event Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, wc.hInstance, None ) if not self.hwnd: raise WinError() self.wc = wc self.hinst = wc.hInstance self.timerInit = Timer( initTime, self.PostInit) # Init delayed init timer ( in case of standby problems) self.timerInit.start()