有没有办法在不使用 WM_GETMINMAXINFO 消息的情况下更改窗口的最大宽度?
我想更改外部应用程序窗口(不是我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道限制窗口大小的唯一两种方法是处理 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.