(Multi-Monitors) How to get the width/height to each monitor

(Multi-Monitors) How to get the width/height to each monitor

Post by Jaw » Sat, 26 Jul 2008 17:47:30


I'd like to list down the width and height to a connected monitors.
But I don't have a good idea to get a HMONITOR in a enumerative way...

Here is my code...

[ code ]
// The number of monitors connected to system
const int nMonitor = ::GetSystemMetrics(SM_CMONITORS);

for(int iMonitor=0 ; iMonitor<nMonitor ; iMonitor++)
{
HMONITOR hMonitor = ???; // This is my question actually. How should
I do to get a HMONITOR from index 'iMonitor' ?

MONITORINFO MtrInfo;
MtrInfo.cbSize = sizeof(MONITORINFO);

::GetMonitorInfo(hMonitor , &MtrInfo);

// Do something with 'MtrInfo'
}
[ /code ]

For I had surveyed.....
MonitorFromPoint(), MonitorFromRect() and MonitorFromWindow() is not
what I exactly want...

Any idea?
 
 
 

(Multi-Monitors) How to get the width/height to each monitor

Post by Jaw » Sat, 26 Jul 2008 17:51:14


I am sorry, it's "to all connected monitors", not "to a connected
monitors".

 
 
 

(Multi-Monitors) How to get the width/height to each monitor

Post by Christian » Sat, 26 Jul 2008 20:20:21

EnumDisplayMonitors



Ch.
 
 
 

(Multi-Monitors) How to get the width/height to each monitor

Post by Mark Salsb » Sun, 27 Jul 2008 03:15:12


Lots of info here...

Windows GDI: Multiple Display Monitors
http://www.yqcomputer.com/ (VS.85).aspx


Mark

--
Mark Salsbery
Microsoft MVP - Visual C++