Beispiel #1
0
 def __start__(self):
     self.buf = collections.deque()
     self.ScanDevices()
     self.hookDll = CDLL(
         abspath(join(dirname(__file__), "RawInputHook.dll")))
     self.messageReceiver = eg.MessageReceiver("RawInputWindow")
     self.messageReceiver.AddHandler(WM_INPUT, self.OnRawInput)
     self.messageReceiver.AddHandler(WM_COPYDATA, self.OnCopyData)
     self.messageReceiver.Start()
     rid = (RAWINPUTDEVICE * 1)()
     rid[0].usUsagePage = 0x01
     rid[0].usUsage = 0x06
     rid[0].dwFlags = RIDEV_INPUTSINK
     rid[0].hwndTarget = self.messageReceiver.hwnd
     RegisterRawInputDevices(rid, 1, sizeof(rid[0]))
     self.hookDll.Start(self.messageReceiver.hwnd)
 def __start__(self, notifications):
     self.notifyMe = notifications
     self.FindWindow()
     if not self.apHwnd:
         self.PrintError('AlbumPlayer is not running.')
         self.TriggerEvent('NotRunning')
         return False
     self.mr = eg.MessageReceiver("AP_plugin_")
     msg = self.mr.AddWmUserHandler(self.SimpleMessageHandler)
     self.mr.AddHandler(WM_COPYDATA, self.XmlMessageHandler)
     if not self.isEnabled:
         self.mr.Start()
     # we want to receive notifications from AlbumPlayer
     win32gui.SendMessage(self.apHwnd, AP_SUBSCRIBE_FOR_INFO, self.mr.hwnd,
                          msg)
     win32gui.SendMessage(self.apHwnd, AP_SUBSCRIBE_FOR_INFO, self.mr.hwnd,
                          WM_COPYDATA)
     self.TriggerEvent('Connected')
     self.isEnabled = True
     return True