Jump to content

~ Limit sizing a window - Problem (SOLVED)


EKY32
 Share

Recommended Posts

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]

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...