Solved

get size of monitor

Posted on 2006-11-08
3
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
move a line in eclipse 3 111
sumHeights2  challenge 7 139
mapAB Challlenge 35 185
Is there a simple front-end menu system. 9 146
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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…
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.

734 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