0

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?

chenxu
  • 71
  • 6

1 Answers1

0

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 flagsSW_SHOWMAXIMIZED`.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Does this way can keep the window full screen when I change the display resolution? Could you please show the code? – chenxu Jun 20 '22 at 02:32