Sign in to follow this  
Followers 0
qwert

How to allow window height resize, but not width?

7 posts in this topic

I'm specifying $WS_SIZEBOX to allow resizing of my main GUI window ... which works. But I only want to allow resizing of the window height. How can I inhibit any change to the width?

Thanks for any help.

Share this post


Link to post
Share on other sites



Look at GUICtrlSetResizing and $GUI_DOCKWIDTH


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I had tried $GUI_DOCKWIDTH as the default at the top of my script. It only affected controls within the window — not the whole window.

I've since placed it immediately after the GUICreate and specifically for the ContolID of the window ... but that didn't work, either.

Is there a different way to use it?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Try this

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

$hGUI = GUICreate ( "Lock Width", 500, 200, -1, -1, $WS_SIZEBOX )
GUISetState ( )
GUIRegisterMsg ( $WM_GETMINMAXINFO, "_WM_GETMINMAXINFO" )

While 1
    If GUIGetMsg ( ) = -3 Then Exit
WEnd

Func _WM_GETMINMAXINFO ( $hwnd, $Msg, $wParam, $lParam )
    $tagMaxinfo = DllStructCreate ( "int;int;int;int;int;int;int;int;int;int", $lParam )
    DllStructSetData ( $tagMaxinfo,  7, 500 ) ; width Min 500
    DllStructSetData ( $tagMaxinfo,  9, 500 ) ; width Max 500
    Return $GUI_RUNDEFMSG
EndFunc ;==> _WM_GETMINMAXINFO ( )
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Indeed, that does work. Rather than disallow resizing (and not show <-> cursor change), it restricts width to a range ... which is set "500 to 500".

Interesting. I certainly would have never thought of such an approach. But unless someone knows how to "disallow", I'll go with it.

Thanks very much.

Share this post


Link to post
Share on other sites

I do not know any other way...

Glad to help you !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


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
Sign in to follow this  
Followers 0