sl*****@nospam.nospam wrote in
news:jo********************************@4ax.com:
I know how to get the monitor dimensions, virtual monitor
dimensions, but how do I get the location of the second monitor
in relationship to the original?
On the desktop when I go into my property settings for the
monitor I can move around the monitors so if say the second
monitor is lower than the first I can position it accordingly.
Are these values wrote to the registry? Is there some way to
get them? For instance I'd like to know if the secondary monitor
is above, below, to the right, or left of the primary monitor?
Say if it's to the right and not aligned perfectly I'd like to
know what Y coordinate it starts/ends at compared to the primary
monitor.
(I don't have a multimonitor setup to test this idea with, so take
it with grain of salt...)
I think the Windows API GetMonitorInfo function will return the
information you're looking for.
http://msdn.microsoft.com/library/de...nitor_27e7.asp
It returns a MONITORINFO structure that contains a rcMonitor RECT
data member. That rectangle is expressed in virtual screen coordinates.
From the documentation, it appears that the coordinates of secondary
monitors are expressed relative to the position of the primary screen.
Reflector (
http://www.aisto.com/roeder/dotnet/) shows how the .Net
framework uses GetMonitorInfo in System.Windows.Forms.Screen,
as well as how it and the MONITORINFO structure are declared for
use with P/Invoke calls in C#.
--
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/