當前位置: 首頁>>代碼示例>>Python>>正文


Python wintypes.WPARAM屬性代碼示例

本文整理匯總了Python中ctypes.wintypes.WPARAM屬性的典型用法代碼示例。如果您正苦於以下問題:Python wintypes.WPARAM屬性的具體用法?Python wintypes.WPARAM怎麽用?Python wintypes.WPARAM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在ctypes.wintypes的用法示例。


在下文中一共展示了wintypes.WPARAM屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run_windows

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import WPARAM [as 別名]
def run_windows(self):
        from ctypes.wintypes import DWORD, WPARAM, LPARAM, MSG

        class KBDLLHOOKSTRUCT(Structure):
            _fields_ = [
                ("vk_code", DWORD),
                ("scan_code", DWORD),
                ("flags", DWORD),
                ("time", c_int),
                ("dwExtraInfo", POINTER(DWORD))
            ]

        def callback(nCode, wParam, lParam):
            pid = c_ulong()
            windll.user32.GetWindowThreadProcessId(windll.user32.GetForegroundWindow(), byref(pid))
            if pid.value == self.pid:
                windll.user32.SendMessageA(self.window.winId(), wParam, lParam.contents.vk_code, 0)
            return windll.user32.CallNextHookEx(None, nCode, wParam, lParam)
 
        function = CFUNCTYPE(c_int, WPARAM, LPARAM, POINTER(KBDLLHOOKSTRUCT))(callback)
        hook = windll.user32.SetWindowsHookExW(13, function, windll.kernel32.GetModuleHandleW(None), 0)

        msg = POINTER(MSG)()
        while self.running:
            try:
                windll.user32.GetMessageW(msg, 0, 0, 0)
                windll.user32.TranslateMessage(msg)
                windll.user32.DispatchMessageA(msg)
            except: pass

        windll.user32.UnhookWindowsHookEx(hook) 
開發者ID:RiotGames,項目名稱:leaguedirector,代碼行數:33,代碼來源:bindings.py

示例2: test_PARAM

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import WPARAM [as 別名]
def test_PARAM(self):
        from ctypes import wintypes
        self.assertEqual(sizeof(wintypes.WPARAM),
                             sizeof(c_void_p))
        self.assertEqual(sizeof(wintypes.LPARAM),
                             sizeof(c_void_p)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:8,代碼來源:test_win32.py

示例3: test_PARAM

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import WPARAM [as 別名]
def test_PARAM(self):
            from ctypes import wintypes
            self.assertEqual(sizeof(wintypes.WPARAM),
                                 sizeof(c_void_p))
            self.assertEqual(sizeof(wintypes.LPARAM),
                                 sizeof(c_void_p)) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:8,代碼來源:test_win32.py


注:本文中的ctypes.wintypes.WPARAM屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。