Exemplo n.º 1
0
    def Setup(self, plugin, waitTime):
        """
        This will be called inside the thread at the beginning.
        """
        self.plugin = plugin
        self.waitTime = waitTime
        self.timer = Timer(0, self.OnTimeOut)
        self.lastEvent = None

        wc = WNDCLASS()
        wc.hInstance = GetModuleHandle(None)
        wc.lpszClassName = "HiddenMceMessageReceiver"
        wc.lpfnWndProc = WNDPROC(self.MyWndProc)
        if not RegisterClass(byref(wc)):
            raise WinError()
        self.hwnd = CreateWindowEx(0, wc.lpszClassName,
                                   "MCE Remote Message Receiver",
                                   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.dll = WinDLL(os.path.join(PLUGIN_DIR, "MceIr.dll"))
        if not self.dll.MceIrRegisterEvents(self.hwnd):
            raise self.plugin.Exceptions.DeviceNotFound
        self.dll.MceIrSetRepeatTimes(1, 1)
    def Setup(self, plugin, msgQueue):
        self.plugin = plugin
        self.msgQueue = msgQueue

        self.wndClass = WNDCLASS(
            lpfnWndProc = WNDPROC(self.WindowProc),
            hInstance = GetModuleHandle(None),
            lpszClassName = "HiddenPCTVMessageReceiver"
        )
        if not RegisterClass(byref(self.wndClass)):
            raise WinError()

        self.hWnd = CreateWindow(
            self.wndClass.lpszClassName,
            self.wndClass.lpszClassName,
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            None,
            None,
            self.wndClass.hInstance,
            None
        )
        if not self.hWnd:
            raise WinError()

        if not SetProp(self.hWnd, self.wndClass.lpszClassName, 658020):
            raise WinError()
Exemplo n.º 3
0
 def Stop(self):
     self.messageProcs.clear()
     eg.ThreadWorker.Stop(self, 5.0)
     if not UnregisterClass(
         cast(self.classAtom, LPCTSTR),
         GetModuleHandle(None)
     ):
         raise WinError()
Exemplo n.º 4
0
    def __init__(self, parent):
        wx.PyWindow.__init__(self, parent)
        size = GetSystemMetrics(SM_CYHSCROLL), GetSystemMetrics(SM_CXVSCROLL)
        self.SetMinSize(size)
        self.SetMaxSize(size)

        self.sizeGripHandle = CreateWindowEx(0, "Scrollbar", None, FLAGS, 0, 0,
                                             0, 0, self.GetHandle(), 0,
                                             GetModuleHandle(None), None)
Exemplo n.º 5
0
 def __init__(self, windowName):
     self.windowName = windowName
     self.messageProcs = {
         WM_SIZE: [self.WmSizeHandler],
     }
     eg.ThreadWorker.__init__(self)
     wndclass = WNDCLASS(
         lpfnWndProc=WNDPROC(self.WindowProc),
         hInstance=GetModuleHandle(None),
         lpszMenuName=None,
         lpszClassName=self.windowName + "MessageReceiver",
     )
     self.classAtom = RegisterClass(byref(wndclass))
     if not self.classAtom:
         raise WinError()
     self.wndclass = wndclass
     self.hwnd = None
     self.nextWmUserMsg = WM_USER + 1000
     self.wmUserHandlers = {}
     self.freeWmUserMsgs = []