Jorge11 Posted May 12, 2018 Posted May 12, 2018 I have a GUI that has set up a Maximize event function. Inside it, I want to prevent it from using the entire size of the display, so I calculate the correct left, top, width, and heiht. Then I call WinMove with these values. But even though I'm sure that the height is less than the full height possible, after the WinMove it fills the entire height ot the display anyway, which I don't understand. It would help if I knew WHEN the max func is called in relation to what the OS does/may do. Has the OS/Autoit internals already maximized the window by the time my func is invoked? Or does the OS/Autoit internals change the window height after the call? What could be causing the window to use the whole height after WinMove?
LarsJ Posted May 13, 2018 Posted May 13, 2018 The window maximize event is controlled much more by Windows than by AutoIt. Therefore you have to use Windows code to implement such functionality. That is, you have to respond to the WM_GETMINMAXINFO Windows message. Something like this: expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $hGui = GUICreate( "Test", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW ) GUIRegisterMsg( $WM_GETMINMAXINFO, "WM_GETMINMAXINFO" ) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) EndFunc Func WM_GETMINMAXINFO( $hWnd, $iMsg, $wParam, $lParam ) Static $tagMINMAXINFO = "struct; long ReservedX;long ReservedY;long MaxSizeX;long MaxSizeY;long MaxPositionX;long MaxPositionY;" & _ "long MinTrackSizeX;long MinTrackSizeY;long MaxTrackSizeX;long MaxTrackSizeY; endstruct" Local $tMINMAXINFO = DllStructCreate( $tagMINMAXINFO, $lParam ) DllStructSetData( $tMINMAXINFO, "MaxSizeX", 800 ) DllStructSetData( $tMINMAXINFO, "MaxSizeY", 600 ) DllStructSetData( $tMINMAXINFO, "MaxPositionX", 100 ) DllStructSetData( $tMINMAXINFO, "MaxPositiony", 100 ) DllStructSetData( $tMINMAXINFO, "MaxTrackSizeX", 800 ) DllStructSetData( $tMINMAXINFO, "MaxTrackSizeY", 600 ) Return 0 #forceref $hWnd, $iMsg, $wParam EndFunc Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now