Solved

get size of monitor

Posted on 2006-11-08
3
225 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
Comment Utility
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
Comment Utility
BTW, see also http://www.codeproject.com/gdi/multimon.asp ("MFC classes for multiple monitors")
0
 

Author Comment

by:DJ_AM_Juicebox
Comment Utility
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now