有没有办法在不使用 WM_GETMINMAXINFO 消息的情况下更改窗口的最大宽度?

发布于 2024-08-30 04:22:40 字数 441 浏览 1 评论 0原文

我想更改外部应用程序窗口(不是我的 C#/WinForms 程序窗口)窗口可以调整大小的强制 Windows 最大宽度。

SM_CXMAXTRACK 的 GetSystemMetrics 的文档说: “具有标题和大小边框的窗口的默认最大宽度(以像素为单位)。此度量指的是整个桌面。用户无法将窗口框架拖动到大于这些尺寸的尺寸。窗口可以通过处理来覆盖此值WM_GETMINMAXINFO 消息。”

有没有一种方法可以修改此 SM_CXMAXTRACK 值(系统范围或特定窗口),而不处理 WM_GETMINMAXINFO 消息?也许是未记录的功能、注册表设置等?

(或者: MINMAXINFO.ptMaxTrackSize 的文档说:“该值基于虚拟屏幕的大小,可以通过编程方式从系统指标 SM_CXMAXTRACK 和 SM_CYMAXTRACK 获取。”也许有一种方法可以更改虚拟屏幕的大小?)

谢谢

I want to change the imposed Windows maximum width that a window can be resized to, for an external application's window (not my C#/WinForms program's window).

The documentation of GetSystemMetrics for SM_CXMAXTRACK says:
"The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message."

Is there a way to modify this SM_CXMAXTRACK value (either system wide or for one particular window), without processing the WM_GETMINMAXINFO message? Maybe an undocumented function, a registry setting, etc.?

(Or: The documentation for MINMAXINFO.ptMaxTrackSize says: "This value is based on the size of the virtual screen and can be obtained programmatically from the system metrics SM_CXMAXTRACK and SM_CYMAXTRACK." Maybe there is a way to change the size of the virtual screen?)

Thank you

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

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

发布评论

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

评论(1

毅然前行 2024-09-06 04:22:40

我知道限制窗口大小的唯一两种方法是处理 WM_GETMINMAXINFO,或者修改 WM_WINDOWPOSCHANGING 中 WINDOWPOS 结构中传递的值。这两种方法都涉及能够拦截和处理窗口的消息。据我所知,没有外部设置可以限制窗口的大小。

如果您没有其他应用程序的源代码,我唯一建议的就是编写一个将代码注入其他应用程序的程序(通过 SetWindowsHookEx 或 CreateRemoteThread),然后子类化窗口并处理这些消息。

The only two ways I know of of limiting the size of a Window is by handling WM_GETMINMAXINFO, or by modifying the values passed in the WINDOWPOS structure in WM_WINDOWPOSCHANGING. Both of these methods involve being able to intercept and handle the messages for the Window. There's no external setting to limit the size of a Window as far as I know.

If you don't have the source code to the other app about the only thing I could suggest is to write a program that injects code into the other app (via SetWindowsHookEx or CreateRemoteThread), and then subclass the window and handle those messages.

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