Reputation: 71
In my app, I want to keep my window full screen. So I added resizing window function when received WM_DISPLAYCHANGE event. In the resizing window function, I use EnumDisplayMonitors to get current size of monitor, the size is correct. Then I use SetWindowPos function to set my window size equal to the monitor. But after SetWindowPos called, I found my window is still a little smaller than the monitor size some time. It seems that the desktop is not ready enough. I also set SWP_NOSENDCHANGING flag in the SetWindowPos function but still not work. Is there any way to solve this problem?
Upvotes: 0
Views: 330
Reputation: 162164
The usual approach to make a window full screen is not by reacting dynamically to WM_DISPLAYCHANGE
or query the display dimensions. The canonical way to make a window full screen is to set its style to 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 *ShowWindowwith flags
SW_SHOWMAXIMIZED`.
Upvotes: 0