/ Eric
I don't think you can rely on this in a multi-monitor setup. MSDN says
that the window returned by GetDesktopWindow covers the entire screen. A
monitor above or to the left of the primary monitor has negative
coordinates. Therefore if the primary monitor is not the leftmost or
topmost monitor, GetDesktopWindow will have rect.left != 0 or rect.top != 0.
In short: no, you can't rely on it.
--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/
Nope, looks like I'm wrong.
"Multiple Monitor System Metrics" says:
The rectangle of the desktop window returned by GetWindowRect or
GetClientRect is always equal to the rectangle of the primary
monitor, for compatibility with existing applications. Thus, the
result of
GetWindowRect(GetDesktopWindow(), &rc);
will be:
rc.left = 0;
rc.top = 0;
rc.right = GetSystemMetrics (SM_CXSCREEN);
rc.bottom = GetSystemMetrics (SM_CYSCREEN);
So it looks like you're safe.
Thanks for the quick reply, Tim. It's nice because it simplifies some
calculations a bit, but being a bit paranoid I decided to leave an assertion
in just in case.
/ Eric
Keep in mind that any window other than the desktop window may have
negative window coordinates. (Because of the arrangement of my
physical desk, my primary monitor is at (0, 0, 1600, 1200), while my
second monitor is at (-1600, 0, 0, 1200)).
--
Sev