简体   繁体   English

关于用SetWindowPos设置窗口全屏的问题

[英]Question about set window full screen with SetWindowPos

In my app, I want to keep my window full screen.在我的应用程序中,我想让我的窗口全屏显示。 So I added resizing window function when received WM_DISPLAYCHANGE event.所以我在收到 WM_DISPLAYCHANGE 事件时添加了调整窗口大小的功能。 In the resizing window function, I use EnumDisplayMonitors to get current size of monitor, the size is correct.在调整窗口大小功能中,我使用 EnumDisplayMonitors 来获取显示器的当前大小,大小是正确的。 Then I use SetWindowPos function to set my window size equal to the monitor.然后我使用 SetWindowPos 函数将我的窗口大小设置为等于监视器。 But after SetWindowPos called, I found my window is still a little smaller than the monitor size some time.但是在调用 SetWindowPos 之后,我发现我的窗口仍然比显示器尺寸小了一段时间。 It seems that the desktop is not ready enough.桌面似乎还没有准备好。 I also set SWP_NOSENDCHANGING flag in the SetWindowPos function but still not work.我还在 SetWindowPos 函数中设置了 SWP_NOSENDCHANGING 标志,但仍然无法正常工作。 Is there any way to solve this problem?有没有办法解决这个问题?

The usual approach to make a window full screen is not by reacting dynamically to WM_DISPLAYCHANGE or query the display dimensions.使窗口全屏的常用方法不是动态WM_DISPLAYCHANGE或查询显示尺寸。 The canonical way to make a window full screen is to set its style to WS_MAXIMIZE | WS_POPUP | WS_VISIBLE使窗口全屏的规范方法是将其样式设置为WS_MAXIMIZE | WS_POPUP | WS_VISIBLE WS_MAXIMIZE | WS_POPUP | WS_VISIBLE WS_MAXIMIZE | WS_POPUP | WS_VISIBLE its extended style to WS_EX_TOPMOST using SetWindowLong , followed by a call to SetWindowPos with flag SWP_FRAMECHANGED , then maximize it with *ShowWindow with flags SW_SHOWMAXIMIZED`. WS_MAXIMIZE | WS_POPUP | WS_VISIBLE使用SetWindowLong将其扩展样式扩展到WS_EX_TOPMOST ,然后使用标志 SWP_FRAMECHANGED 调用SetWindowPos ,然后使用with flags SWP_FRAMECHANGED的 *ShowWindow 将其最大化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM