EndangeringSpecies
EndangeringSpecies

Reputation: 1594

can I resize a program window in Windows to be arbitrarily large?

it seems that the size of the window, e.g. of an open browser, is capped based on the screen size or screen resolution or something along these lines. Is there a way to go around this and make the window arbitrarily tall?

Upvotes: 3

Views: 524

Answers (4)

EndangeringSpecies
EndangeringSpecies

Reputation: 1594

will (partially) answer my own question. It turns out that for the specific case of my own WinForms app it's just a matter of setting Form.MaximumSize to a big enough value and then increasing Form.ClientSize. I guess this MaximumSize property is a wrapper around the WM_GETMINMAXINFO hook mentioned in the other answers.

Upvotes: 1

Matt
Matt

Reputation: 7160

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

$hGUI = GUICreate("", 250, 100, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_THICKFRAME))
GUICtrlCreateLabel("", 0, 0, 250, 100, -1, $GUI_WS_EX_PARENTDRAG)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_GETMINMAXINFO, "")
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam, $lParam
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, 250) ; min width
    DllStructSetData($minmaxinfo, 8, 100) ; min height
    DllStructSetData($minmaxinfo, 9, 3000) ; max width
    DllStructSetData($minmaxinfo, 10, 3000) ; max height
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_GETMINMAXINFO

Upvotes: 2

Martyn Lovell
Martyn Lovell

Reputation: 2276

If you are talking about your own application, you can probably render up to the 16 bit coordinates that are used for GDI sizing. Respond appropriately to WM_GETMINMAXINFO and others.

If you are talking about someone else's, there is no promise that they will render larger than the screen since would be wise to clip their painting to what is visible, and they may be further constrained by other factors (such as the size of a DirectX surface which is smaller than the GDI limit).

Likely if you are scraping you would be better to use MSAA or UIA to manipulate the window from outside and get its text.

Martyn

Upvotes: 1

Mike Kwan
Mike Kwan

Reputation: 24477

Yes there is. You must override WM_GETMINMAXINFO. In your hook procedure you can set the maximum x/y:

MINMAXINFO* pmmi = (MINMAXINFO*)lParam;
pmmi->ptMaxTrackSize.x = desiredY;
pmmi->ptMaxTrackSize.y = desiredX;

To do this on another process you can use SetWindowsHookEx() with WH_GETMESSAGE.

Upvotes: 2

Related Questions