Opt("GUIOnEventMode", 1)
GUICreate("限制窗口大小示例", -1, -1, -1, -1, 0x40000)
GUISetOnEvent(-3, "GuiEvent")
GUIRegisterMsg(0x24, "WM_GETMINMAXINFO")
GUISetState()
While 1
Sleep(100)
WEnd
Func GuiEvent()
Switch @GUI_CtrlId
Case -3
GUIDelete()
Exit
EndSwitch
EndFunc ;==>GuiEvent
Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lparam)
Local $tBuffer = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lparam)
DllStructSetData($tBuffer, 7, 400);限制窗口的最小宽度为400
DllStructSetData($tBuffer, 8, 250);限制窗口的最小高度为600
DllStructSetData($tBuffer, 9, 600);限制窗口的最大宽度为600
DllStructSetData($tBuffer, 10, 800);限制窗口的最大宽度为800
Return "GUI_RUNDEFMSG"
EndFunc
|