1 回答

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊
win32gui
經(jīng)過一段時(shí)間的搜索和嘗試不同的東西,我找到了C 中的代碼。
它使用對應(yīng)于ctypes.py_object
.
工作代碼如下:
from ctypes import byref, py_object, windll, WINFUNCTYPE
from ctypes.wintypes import BOOL, HWND
def func(hwnd, param):
? param.append(hwnd)
? return True
def code():
? arr = []
? WNDENUMPROC = WINFUNCTYPE(BOOL, HWND, py_object)
? windll.user32.EnumChildWindows.argtypes = [HWND, WNDENUMPROC, py_object]
? windll.user32.EnumChildWindows.restype = BOOL
? windll.user32.EnumChildWindows(windll.user32.GetDesktopWindow(), WNDENUMPROC(func), arr)
? print(arr)
code()
添加回答
舉報(bào)