INNER CODE UNIT · Python
bytes_buffer
Qwejay/Qflow · main.py:288
bytes_buffer = ctypes.create_unicode_buffer(length + 1)
user32.GetWindowTextW(hwnd, bytes_buffer, length + 1)
title = bytes_buffer.value
cls_buff = ctypes.create_unicode_buffer(256)
user32.GetClassNameW(hwnd, cls_buff, 256)
class_name = cls_buff.value
pid = ctypes.c_ulong()
user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
exe_name = pid_map.get(pid.value, "") if pid_map else ""
return {'hwnd': hwnd, 'title': title, 'class_name': class_name, 'exe_name': exe_name, 'pid': pid.value}
@staticmethod
def get_window_rect(hwnd):
try:
rect = ctypes.wintypes.RECT()
if ctypes.windll.dwmapi.DwmGetWindowAttribute(hwnd, 9, ctypes.byref(rect), ctypes.sizeof(rect)) == 0:
return Box(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)
except: pass