I have an odd issue when I run with a particular monitor configuration and I use the per monitor DPI awareness context for my app. First here is my current configuration when I open the Display settings.
Monitor 2 Monitor 3 Monitor 1
Monitor 2 is a 1680x1050 resolution, DPI is 100%, landscape and I have Extend desktop to this display.
Monitor 3 is a 3840 x 2160 resolution, DPI is 200%, landscape and is my main display.
Monitor 1 is a 1920x1080 resolution, DPI is 100%, landscape and I have Extend desktop to this display.
My issue is with some tool windows I have for which we save the location for when we close them and when we want to use them again, we create and set the size and position back to the saved data. If the tool window is on the monitor to the right of my main monitor (that is on Monitor 1) AND my frame window is on the main monitor, when I create the tool window and display it, though I get the messages expected, including WM_PAINT, the window does not display. Spyxx shows me the window, the styles, parent etc. and the rectangles used. I note the owner is my main frame and the desktop is the parent.
If the tool window is on the main monitor or the left monitor (Monitor 2), I have no issue. I thought the issue was related to the saved position data.
However, if the owner window, which is my main frame, is on Monitor 2, I have no problem at all. I have started my app and moved the frame so it is on the right monitor (1) and then I run code that creates the tool window. All the messages come thru, including WM_PAINT and the window shows up. I use Spy and it shows me the exact same info as when the window does not show up.
To recap, this issue depends on DPI awareness being per monitor AND my frame window being positioned on my main 4k monitor which has a DPI setting of 200%.
I have also tried, and have no problem if my main frame is on monitor 2, which is to the left of monitor 3. Again, all the data Spyxx shows me is the same and my window shows up on Monitor 1 with no problem. Indeed, I only get this issue if my main frame is on the 4k (main) monitor. It doesn't matter if I start with it on that monitor or not. All I have to do is move my main frame to either of the other monitors.
I do see one thing that may be a clue. When I have my frame on the right monitor (monitor 1), and I show the window, it isn't the right size. But, as soon as I click it it scales up to the correct size. But, I have seen that with office and visual studio, Edge, Chrome and a number of other apps that create a window after the frame is displayed.
I have tried extra calls to Invalidate, ShowWindow(SW_HIDE) followed by ShowWindow(SW_SHOW) to try and get it to display. I still suspect that something thinks the window is off screen but only when my main frame, the owner is on the 4k main monitor. Also, no problem if my awareness is system aware.