Solved

get size of monitor

Posted on 2006-11-08
3
230 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:DJ_AM_Juicebox
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17900197
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
 
LVL 86

Expert Comment

by:jkr
ID: 17900272
BTW, see also http://www.codeproject.com/gdi/multimon.asp ("MFC classes for multiple monitors")
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 17901005
thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question