Python ctypes.wintypes.LPARAM Examples
The following are 24
code examples of ctypes.wintypes.LPARAM().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ctypes.wintypes
, or try the search function
.
Example #1
Source File: release_puppet_unity_ths.py From puppet with MIT License | 6 votes |
def finder(register): ''' 枚举所有可用的broker交易端并实例化 ''' team = set() buff = buffer(32) @ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM) def check(hwnd, extra): if op.IsWindowVisible(hwnd): op.GetWindowTextW(hwnd, buff, 32) if '交易系统' in buff.value: team.add(hwnd) return 1 op.EnumWindows(check, 0) def get_nickname(hwnd): account = hwnd for i in 59392, 0, 1711: account = op.GetDlgItem(account, i) op.SendMessageW(account, WM_GETTEXT, 32, buff) return register.get(buff.value[-3:]) return {get_nickname(hwnd): unity(hwnd) for hwnd in team if hwnd}
Example #2
Source File: puppet_util.py From puppet with MIT License | 6 votes |
def get_root(key: list =['网上股票交易系统', '通达信']) -> tuple: from ctypes.wintypes import BOOL, HWND, LPARAM @ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM) def callback(hwnd, lparam): user32.GetWindowTextW(hwnd, buf, 64) for s in key: if s in buf.value: handle.value = hwnd return False return True buf = ctypes.create_unicode_buffer(64) handle = ctypes.c_ulong() user32.EnumWindows(callback) return handle.value, buf.value
Example #3
Source File: test_win32.py From ironpython3 with Apache License 2.0 | 5 votes |
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))
Example #4
Source File: test_win32.py From android_universal with MIT License | 5 votes |
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))
Example #5
Source File: test_callbacks.py From android_universal with MIT License | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #6
Source File: test_win32.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
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))
Example #7
Source File: test_callbacks.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #8
Source File: test_win32.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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))
Example #9
Source File: test_callbacks.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #10
Source File: test_win32.py From datafari with Apache License 2.0 | 5 votes |
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))
Example #11
Source File: test_callbacks.py From datafari with Apache License 2.0 | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #12
Source File: bindings.py From leaguedirector with Apache License 2.0 | 5 votes |
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)
Example #13
Source File: test_callbacks.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #14
Source File: test_win32.py From Imogen with MIT License | 5 votes |
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))
Example #15
Source File: test_callbacks.py From Imogen with MIT License | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #16
Source File: test_win32.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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))
Example #17
Source File: test_callbacks.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #18
Source File: test_win32.py From oss-ftp with MIT License | 5 votes |
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))
Example #19
Source File: test_callbacks.py From oss-ftp with MIT License | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #20
Source File: test_win32.py From BinderFilter with MIT License | 5 votes |
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))
Example #21
Source File: test_callbacks.py From BinderFilter with MIT License | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #22
Source File: test_win32.py From ironpython2 with Apache License 2.0 | 5 votes |
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))
Example #23
Source File: test_callbacks.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_issue_8959_b(self): from ctypes.wintypes import BOOL, HWND, LPARAM global windowCount windowCount = 0 @WINFUNCTYPE(BOOL, HWND, LPARAM) def EnumWindowsCallbackFunc(hwnd, lParam): global windowCount windowCount += 1 return True #Allow windows to keep enumerating windll.user32.EnumWindows(EnumWindowsCallbackFunc, 0)
Example #24
Source File: vcp.py From monitor_ctrl with MIT License | 4 votes |
def enumerate_monitors() -> list: """ enumerate all physical monitor. ** 请注意防止返回的 Handle 对象被GC! https://msdn.microsoft.com/en-us/library/dd162610(v=vs.85).aspx BOOL EnumDisplayMonitors( _In_ HDC hdc, _In_ LPCRECT lprcClip, _In_ MONITORENUMPROC lpfnEnum, _In_ LPARAM dwData ); :return: list contains physical monitor handles """ all_hmonitor = [] # Factory function of EnumDisplayMonitors callback. # 保持引用以防止被GC ! # https://msdn.microsoft.com/en-us/library/dd145061(v=vs.85).aspx _MONITOR_ENUM_PROC = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HMONITOR, wintypes.HDC, ctypes.POINTER(wintypes.LPRECT), wintypes.LPARAM) def __monitor_enum_proc_callback(hmonitor_: wintypes.HMONITOR, hdc, lprect, lparam) -> bool: """ EnumDisplayMonitors callback, append HMONITOR to all_hmonitor list. :param hmonitor_: :param hdc: :param lprect: :param lparam: :return: """ all_hmonitor.append(hmonitor_) return True if not ctypes.windll.user32.EnumDisplayMonitors(None, None, _MONITOR_ENUM_PROC(__monitor_enum_proc_callback), None): raise ctypes.WinError() # get physical monitor handle handles = [] for hmonitor in all_hmonitor: handles.extend(_get_physical_monitors_from_hmonitor(hmonitor)) return handles