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?
4 Answers
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.

- 24,123
- 12
- 63
- 96
#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

- 7,100
- 3
- 28
- 58
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

- 2,086
- 11
- 13
-
Martyn, could you please elaborate on the "MSAA or UIA" bit? The original problem seems resolved for now, but "knowledge is good", both for me and for other readers here :) – EndangeringSpecies Jul 18 '11 at 14:05
-
MSAA (older) and UIA (newer) are two accessibility APIs provided by Windows for accessibility tools (screen readers, etc) to get at and modify the UI on screen. This makes them very useful for other things, like testing, screen scraping, etc. They are well-documented on MSDN, for hwnd UIs everything starts with WM_GETOBJECT. – Martyn Lovell Jul 18 '11 at 19:23
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.

- 1,564
- 1
- 17
- 39