我正在开发python的工具, 它需要能够强制改变窗口大小, 但有些窗户的最小尺寸受系统限制
例如探索窗口最小尺寸为160 x240
用Google搜索,MINMAXINFO定义了窗口的最小尺寸,
我尝试更改MINMAXINFO的信息,
但它不起作用,这是我的代码,
任何人都可以给出一些建议 使其有效?
import ctypes
from ctypes.wintypes import POINT
class MINMAXINFO(ctypes.Structure):
_fields_ = [
("ptReserved", POINT),
("ptMaxSize", POINT),
("ptMaxPosition", POINT),
("ptMinTrackSize", POINT),
("ptMaxTrackSize", POINT),
]
lparam = MINMAXINFO()
WM_GETMINMAXINFO = 36
msg=WM_GETMINMAXINFO
hwnd = 334512 #hwnd of test window
def on_getminmaxinfo(hwnd, msg, lparam):
info = ctypes.cast(lparam, ctypes.POINTER(MINMAXINFO)).contents
point = POINT(9, 9)
info.ptMinTrackSize = point
ctypes.windll.user32.MoveWindow(334512, 0, 0, 120, 10, 1)