本文整理汇总了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)
示例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))
示例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))