Sign in to follow this  
Followers 0
EKY32

~ Limit sizing a window - Problem (SOLVED)

3 posts in this topic

#1 ·  Posted (edited)

I used this script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

$Form1 = GUICreate("Form1", 615, 438, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
GUISetState(@SW_SHOW)

$Form2 = GUICreate("Form2", 200, 200, 500, 20, BitOR($WS_THICKFRAME, $WS_SYSMENU, $WS_POPUP), $WS_EX_MDICHILD, $Form1)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd


Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
#forceref $hwnd, $Msg, $wParam, $lParam
Local $GUIMINWID = 627, $GUIMINHT = 438
$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
Return 0
EndFunc ;==>WM_GETMINMAXINFO

It works fine but when i move\drag the $Form1, the stupid $Form2 is being resized -_- .. I know it can be fixed some how, a little help please?

Thank you.

Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Probably something like this, also take note that the minimum value you were specifying was larger than the creation value you were using.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

Global $Form1 = GUICreate("Form1", 615, 438, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
GUISetState(@SW_SHOW)

Global $Form2 = GUICreate("Form2", 200, 200, 500, 20, BitOR($WS_THICKFRAME, $WS_SYSMENU, $WS_POPUP), $WS_EX_MDICHILD, $Form1)
GUISetState(@SW_SHOW)

GUISwitch($Form1);switch to main gui $Form1 after creating all controls etc
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $iMsg, $WPARAM, $LPARAM)
    #forceref $iMsg, $WPARAM
    Switch $hWnd
        Case $Form1
            $GUIMINWID = 600
            $GUIMINHT = 400
        Case $Form2
            $GUIMINWID = 200
            $GUIMINHT = 200
    EndSwitch
    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, 99999) ; max X
    DllStructSetData($tagMaxinfo, 10, 99999) ; max Y
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_GETMINMAXINFO
Edited by CaptainClucks

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Well, thank you Mr CaptainClucks, it works fine now.

Yes i noticed that as I paid attention to the window's frame :)

Thank you.


[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

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