本文整理汇总了Python中ctypes.wintypes.HWND属性的典型用法代码示例。如果您正苦于以下问题:Python wintypes.HWND属性的具体用法?Python wintypes.HWND怎么用?Python wintypes.HWND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ctypes.wintypes
的用法示例。
在下文中一共展示了wintypes.HWND属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_argtypes
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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]
示例2: get_root
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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
示例3: finder
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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}
示例4: test_issue_8959_b
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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)
示例5: test_HWND
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
def test_HWND(self):
from ctypes import wintypes
self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
示例6: test_issue_8959_b
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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)
示例7: test_HWND
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
def test_HWND(self):
from ctypes import wintypes
self.assertEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
示例8: find_window
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
def find_window(class_name: wintypes.LPCSTR, title: wintypes.LPCSTR) -> wintypes.HWND:
pass
示例9: get_window_thread_process_id
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
def get_window_thread_process_id(
handle: wintypes.HWND, process_id_ptr: wintypes.LPDWORD
) -> wintypes.DWORD:
pass
示例10: WinMSGLoop
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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)
示例11: __init__
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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.
示例12: WinMSGLoop
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import HWND [as 别名]
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)