I have 2 monitors, A monitor is the primary monitor with a resolution of 3840x2160. B monitor is the secondary monitor with a resolution of 2560x1440. In my application, I use the following code to create a WS_POPUP style window and adjust its position.
window->Create(nullptr, "Title", WS_POPUP, WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
SetWindowPos(GetHWND(), NULL, x, y, widnow_height, window_height, SWP_NOZORDER | SWP_NOACTIVATE);
ShowWindow();
It works perfectly when I put the main window on primary monitor(A monitor) and create the WS_POPUP window and show it. However, I put the main window on the secondary monitor(B monitor) and create & show the WS_POPUP window, the window's size become smaller and it not appears in the correct position. Why?
More information: The strange behavior mentioned above disappeared when a SWP_NOACTIVATE flag added when create the WS_POPUP window:
window->Create(nullptr, "Title", WS_POPUP, WS_EX_TOPMOST | WS_EX_TOOLWINDOW | SWP_NOACTIVATE);
SetWindowPos(GetHWND(), NULL, x, y, widnow_height, window_height, SWP_NOZORDER | SWP_NOACTIVATE);
ShowWindow();
Just want to know the deep reason of the strange behavior.