On dual display systems, what determines which display a window opens on?
That is, I want to use ATL 8.1 to open a window with Create(),
but it does not seem to have a argument to specify display?
How do you ask a window which display it is currently on?
Windows uses it's cascading rules to decide what's opened where if the default position is requested.
That aside, it tries to put it where requested.
I think the second monitor is considered 'more' of the first monitor, so the coordinates carry over.
If you have two monitors side by side, each 10x10 pixels (for example):
.--------. .--------.
| A | | |
| | | B |
'--------' '--------' |
Then it would be as if you had one 20x10 monitor. A might be at (5, 3), and B might be at (13, 6).
Last edited on
L B is correct. You can find the number of displays and their coordinates by calling EnumDisplayMonitors().
Thanks for all the answers! That's perfect. Even makes a lot of sense,
from good ol MS.
If I open a window B "owned" by Window A on screen 2, my assumption was that B would open near A, but it always opens on the same primary screen.
In Create() for the window, i passed in the value for default position, thinking near its owner would be the default.
Is there any way to ask Windows for a "safe" screen position near window A?
I know I can get A's position, but then I need to offset it a bit (cascade) and
then I need to make sure its all visible, not clipped off the bottom.
Is there a way I can just feed a position and say "make sure its visible", so I'm not reinventing the wheel there?