我可以将 Windows 中的程序窗口调整为任意大吗?

发布于 2024-11-24 13:17:57 字数 74 浏览 8 评论 0原文

看起来窗口的大小(例如打开的浏览器的窗口的大小)是根据屏幕大小或屏幕分辨率或类似的东西来限制的。有没有办法解决这个问题并使窗口任意高?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

陌上芳菲 2024-12-01 13:17:57

是的,有。您必须覆盖 WM_GETMINMAXINFO。在您的挂钩过程中,您可以设置最大 x/y:

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

要在另一个进程上执行此操作,您可以将 SetWindowsHookEx() 与 WH_GETMESSAGE 一起使用。

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.

最偏执的依靠 2024-12-01 13:17:57
#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
#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
半﹌身腐败 2024-12-01 13:17:57

如果您正在谈论您自己的应用程序,您可能最多可以渲染用于 GDI 大小调整的 16 位坐标。适当地响应 WM_GETMINMAXINFO 和其他。

如果您谈论的是其他人的,则不能保证他们会渲染得比屏幕更大,因为将他们的绘画剪裁到可见的内容是明智的,并且他们可能会进一步受到其他因素的限制(例如 DirectX 的大小)表面小于 GDI 限制)。

可能如果您正在抓取,您最好使用 MSAA 或 UIA 从外部操作窗口并获取其文本。

马丁

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

决绝 2024-12-01 13:17:57

将(部分)回答我自己的问题。事实证明,对于我自己的 WinForms 应用程序的具体情况,只需将 Form.MaximumSize 设置为足够大的值,然后增加 Form.ClientSize 即可。我想这个 MaximumSize 属性是其他答案中提到的 WM_GETMINMAXINFO 挂钩的包装器。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文