当前位置: 首页>>代码示例>>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;未经允许,请勿转载。