Solved

get size of monitor

Posted on 2006-11-08
3
228 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASCII Non-Printable characters/codes and their HTML equivalents 6 115
has22 challenge 11 94
firstChar challenge 13 115
wordappend challenge 8 176
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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