By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,393 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,393 IT Pros & Developers. It's quick & easy.

How to get Multi-Monitor Position?

P: n/a
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.
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/
Nov 17 '05 #2

P: n/a
Thank You! I got it figured out now.
Nov 17 '05 #3

P: n/a
What happens if you get the bounds for each monitor? Is the upper-left
always 0,0 or is the second monitor adjusted based on its position in
"virtual space"?

If the upper-left is relative, then you might be able to use this, along
with the width and height of each, to determine their relative position.
<sl*****@nospam.nospam> wrote in message
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.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.