Python ctypes.wintypes.HWND Examples
The following are 30
code examples of ctypes.wintypes.HWND().
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: client.py From gdog with GNU General Public License v3.0 | 7 votes |
def _set_argtypes(self): ''' Functions arguments. ''' self.MONITORENUMPROC = WINFUNCTYPE(INT, DWORD, DWORD, POINTER(RECT), DOUBLE) windll.user32.GetSystemMetrics.argtypes = [INT] windll.user32.EnumDisplayMonitors.argtypes = [HDC, c_void_p, self.MONITORENUMPROC, LPARAM] windll.user32.GetWindowDC.argtypes = [HWND] windll.gdi32.CreateCompatibleDC.argtypes = [HDC] windll.gdi32.CreateCompatibleBitmap.argtypes = [HDC, INT, INT] windll.gdi32.SelectObject.argtypes = [HDC, HGDIOBJ] windll.gdi32.BitBlt.argtypes = [HDC, INT, INT, INT, INT, HDC, INT, INT, DWORD] windll.gdi32.DeleteObject.argtypes = [HGDIOBJ] windll.gdi32.GetDIBits.argtypes = [HDC, HBITMAP, UINT, UINT, c_void_p, POINTER(BITMAPINFO), UINT]
Example #2
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 #3
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 #4
Source File: implant.py From gcat with BSD 2-Clause "Simplified" License | 6 votes |
def _set_argtypes(self): ''' Functions arguments. ''' self.MONITORENUMPROC = WINFUNCTYPE(INT, DWORD, DWORD, POINTER(RECT), DOUBLE) windll.user32.GetSystemMetrics.argtypes = [INT] windll.user32.EnumDisplayMonitors.argtypes = [HDC, c_void_p, self.MONITORENUMPROC, LPARAM] windll.user32.GetWindowDC.argtypes = [HWND] windll.gdi32.CreateCompatibleDC.argtypes = [HDC] windll.gdi32.CreateCompatibleBitmap.argtypes = [HDC, INT, INT] windll.gdi32.SelectObject.argtypes = [HDC, HGDIOBJ] windll.gdi32.BitBlt.argtypes = [HDC, INT, INT, INT, INT, HDC, INT, INT, DWORD] windll.gdi32.DeleteObject.argtypes = [HGDIOBJ] windll.gdi32.GetDIBits.argtypes = [HDC, HBITMAP, UINT, UINT, c_void_p, POINTER(BITMAPINFO), UINT]
Example #5
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 #6
Source File: win.py From gd.py with MIT License | 5 votes |
def get_window_thread_process_id( handle: wintypes.HWND, process_id_ptr: wintypes.LPDWORD ) -> wintypes.DWORD: pass
Example #7
Source File: ddeclient.py From pymt5 with MIT License | 5 votes |
def WinMSGLoop(): """Run the main windows message loop.""" LPMSG = POINTER(MSG) LRESULT = c_ulong GetMessage = get_winfunc("user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT)) TranslateMessage = get_winfunc("user32", "TranslateMessage", BOOL, (LPMSG,)) # restype = LRESULT DispatchMessage = get_winfunc("user32", "DispatchMessageW", LRESULT, (LPMSG,)) msg = MSG() lpmsg = byref(msg) while GetMessage(lpmsg, HWND(), 0, 0) > 0: TranslateMessage(lpmsg) DispatchMessage(lpmsg)
Example #8
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 #9
Source File: test_win32.py From datafari with Apache License 2.0 | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #10
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 #11
Source File: test_win32.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #12
Source File: test_win32.py From android_universal with MIT License | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #13
Source File: test_win32.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #14
Source File: client.py From canisrufus with GNU General Public License v3.0 | 5 votes |
def _set_argtypes(self): ''' Functions arguments. ''' self.MONITORENUMPROC = WINFUNCTYPE(INT, DWORD, DWORD, POINTER(RECT), DOUBLE) windll.user32.GetSystemMetrics.argtypes = [INT] windll.user32.EnumDisplayMonitors.argtypes = [HDC, c_void_p, self.MONITORENUMPROC, LPARAM] windll.user32.GetWindowDC.argtypes = [HWND] windll.gdi32.CreateCompatibleDC.argtypes = [HDC] windll.gdi32.CreateCompatibleBitmap.argtypes = [HDC, INT, INT] windll.gdi32.SelectObject.argtypes = [HDC, HGDIOBJ] windll.gdi32.BitBlt.argtypes = [HDC, INT, INT, INT, INT, HDC, INT, INT, DWORD] windll.gdi32.DeleteObject.argtypes = [HGDIOBJ] windll.gdi32.GetDIBits.argtypes = [HDC, HBITMAP, UINT, UINT, c_void_p, POINTER(BITMAPINFO), UINT]
Example #15
Source File: pygameWindowInfo.py From RebirthItemTracker with BSD 2-Clause "Simplified" License | 5 votes |
def __init__(self): """Initialize our object""" # Find the start x,y pos of the main pygame *screen* (the screen in the # window): sdlpos = os.getenv("SDL_VIDEO_WINDOW_POS") if sdlpos is None: raise Exception("Must have previously setup a Pygame window starting position via the 'SDL_VIDEO_WINDOW_POS' evn var.") self.initPygameScreenPos = [int(i) for i in sdlpos.split(",")] # Run our ctypes code to query window position: try: # It's said that not all systems support this dictionary key. I'm # not sure what systmes those are, but might as well put a check in. self.hwnd = pygame.display.get_wm_info()["window"] except KeyError: raise Exception("Your system isn't accepting the code: 'pygame.display.get_wm_info()[\"window\"]', must not be supported :-(") self.prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) self.paramflags = (1, "hwnd"), (2, "lprect") self.GetWindowRect = self.prototype(("GetWindowRect", windll.user32), self.paramflags) # Find the initial *window* position: rect = self.GetWindowRect(self.hwnd) # Calculate the thickness of the *window* border to the *screen* object inside: self.borderThickness = int(self.initPygameScreenPos[0]) - rect.left self.titleThickness = int(self.initPygameScreenPos[1]) - rect.top # borderThickness is the left, right, and bottom window edges. titleThickness # is th thickness of the top title-bar of the window.
Example #16
Source File: dde.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def WinMSGLoop(): """Run the main windows message loop.""" from ctypes import POINTER, byref, c_ulong from ctypes.wintypes import BOOL, HWND, MSG, UINT LPMSG = POINTER(MSG) LRESULT = c_ulong GetMessage = get_winfunc( "user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT) ) TranslateMessage = get_winfunc( "user32", "TranslateMessage", BOOL, (LPMSG,) ) # restype = LRESULT DispatchMessage = get_winfunc( "user32", "DispatchMessageW", LRESULT, (LPMSG,) ) msg = MSG() lpmsg = byref(msg) while GetMessage(lpmsg, HWND(), 0, 0) > 0: TranslateMessage(lpmsg) DispatchMessage(lpmsg)
Example #17
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 #18
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 #19
Source File: win.py From gd.py with MIT License | 5 votes |
def find_window(class_name: wintypes.LPCSTR, title: wintypes.LPCSTR) -> wintypes.HWND: pass
Example #20
Source File: test_win32.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #21
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 #22
Source File: test_win32.py From Imogen with MIT License | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #23
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 #24
Source File: test_win32.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #25
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 #26
Source File: test_win32.py From oss-ftp with MIT License | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #27
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 #28
Source File: test_win32.py From BinderFilter with MIT License | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
Example #29
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 #30
Source File: test_win32.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_HWND(self): from ctypes import wintypes self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))