Jump to content

Resizable window that can also be minimized?


Recommended Posts

I have been trying various combinations to render a GUI window that has a minimize button, but also can be resized. Is that combination possible? I tried combinations of the extended commands using the BitOR along with combinations of the WS_SIZEBOX and others, but when using that parameter, it nixes the minimize control button and just leaves the close control button. Any ideas? Thanks in advance!

GUICreate("Test GUI", 403, 372,-1,-1)
GUISetState(@SW_SHOW)
While 1
Sleep(1000)
WEnd
Link to post
Share on other sites

Did you remember to specify that you want the minimize button too?

Two ways to do it (just look at GUIGetMsg() in helpfile) =

#include <WindowsConstants.au3>

GUICreate("Test GUI1", 403, 372, 0, 0, $WS_OVERLAPPEDWINDOW)
GUISetState(@SW_SHOW)

GUICreate("Test GUI2", 403, 372, 0, 372, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX))
GUISetState(@SW_SHOW)

While GUIGetMsg() <> -3
WEnd
Link to post
Share on other sites

You can play with this I guess?

AutoItSetOption("GUIOnEventMode",1)
Global Const $WS_RESIZABLE = 0x00070000
Global $GUIMINWID = 300; Resizing / minimum width
Global $GUIMINHT = 300; Resizing / minimum hight
Global $AUT = GUICreate("AutoIt", $GUIMINWID, $GUIMINHT, -1, -1, $WS_RESIZABLE)
GUIRegisterMsg(0x0024, "WM_GETMINMAXINFO"); WM_GETMINMAXINFO , prevent user from making the gui really small
GUISetOnEvent(-3, "_Exit")
GUISetOnEvent(-6, "_Maximize")
GUISetOnEvent(-5, "_Restore")
GUISetOnEvent(-4, "_Minimize")
GUISetState()
While Sleep(100)
WEnd
Func _Maximize()
;WinSetState($AUT, "", @SW_MAXIMIZE)
Beep(100,100)
EndFunc
Func _Restore()
;WinSetState($AUT, "", @SW_RESTORE)
Beep(200,100)
EndFunc
Func _Minimize()
;WinSetState($AUT, "", @SW_MINIMIZE)
Beep(300,100)
EndFunc

Func WM_GETMINMAXINFO($hWnd, $Msg, $WPARAM, $LPARAM)
Beep(500,100)
Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $LPARAM)
DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X
DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y
DllStructSetData($tagMaxinfo, 9, $GUIMINWID + 100); max X
DllStructSetData($tagMaxinfo, 10, $GUIMINHT + 100) ; max Y
Return 0
EndFunc   ;==>WM_GETMINMAXINFO
Func _Exit()
Beep(400,100)
Exit
EndFunc
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...