#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
;功能:控制窗口最小尺寸100 x 100,最大尺寸800 x 800
;~ Global Const $WM_GETMINMAXINFO = 0x0024
$Gui = GUICreate("控制窗口大小", 300, 300, -1, -1, 0x00040000) ;$WS_SIZEBOX
GUISetState()
;状态栏设置
Local $aParts[3] = [75, 150, -1]
Local $aText[3] = [75, 150, -1]
$g_hStatus = _GUICtrlStatusBar_Create($Gui, $aParts, $aText)
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") ;注册回调函数
GUIRegisterMsg($WM_SIZE, 'WM_SIZE') ;改变状态栏大小
Do
Until GUIGetMsg() = -3
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
Switch $hWnd
Case $Gui
Switch $wParam
Case 0
Case 1
Case 2
Case 3
Case 4
EndSwitch
EndSwitch
$aPos = WinGetPos($Gui)
If Not IsArray($aPos) Then Return
;这里不会写了
ConsoleWrite($aPos[0] & '->' & $aPos[1] & '->' & $aPos[2] & '->' & $aPos[3] & @CRLF)
EndFunc ;==>WM_SIZE
Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
Local $tagMINMAXINFO = "int;int;int;int;int;int;int;int;int;int"
$MINMAXINFO = DllStructCreate($tagMINMAXINFO, $lParam)
ConsoleWrite($MINMAXINFO)
DllStructSetData($MINMAXINFO, 7, 100) ;min x
DllStructSetData($MINMAXINFO, 8, 100) ;min y
DllStructSetData($MINMAXINFO, 9, 800) ;max x
DllStructSetData($MINMAXINFO, 10, 800) ;max y
EndFunc ;==>WM_GETMINMAXINFO
|