get size of monitor

Hi,

I have a system that has 2 monitors and the user has setup the desktop to be stretched across both monitors. Is there a way to get the size of only monitor # 1?

Thanks
DJ_AM_JuiceboxAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
Yes, you can use 'GetMonitorInfo()' for that purpose which will fill in a 'MONITORINFO' (http://msdn.microsoft.com/library/en-us/gdi/monitor_4lma.asp) struct that has this info:

typedef struct tagMONITORINFO {  
    DWORD  cbSize;
    RECT   rcMonitor;
    RECT   rcWork;
    DWORD  dwFlags;
} MONITORINFO, *LPMONITORINFO;

To get the monitor handle, use e.g. 'MonitorFomPoint()' like

POINT pt;
pt.x = 0;
pt.y = 0;

HMONITOR hm = MonitorFromPoint(pt,MONITOR_DEFAULTTONEAREST);

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

GetMonitorInfo(hm,&mi);
0
 
jkrCommented:
BTW, see also http://www.codeproject.com/gdi/multimon.asp ("MFC classes for multiple monitors")
0
 
DJ_AM_JuiceboxAuthor Commented:
thanks
0
All Courses

From novice to tech pro — start learning today.