Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Getting resolution of second monitor  (Read 1534 times)

0 Members and 1 Guest are viewing this topic.

poncho

  • Newbie
  • *
  • Posts: 7
    • View Profile
Getting resolution of second monitor
« on: August 20, 2011, 11:08:12 am »
Hi,

I am creating a program with 2 seperate windows, one for the monitor and one for the projector. I am using extend desktop and so am positioning the projector window using:

Code: [Select]
ProjectorWindow.setPosition(resolutionWidthOfMonitor, 0);

Which places the top left corner of the window at 0,0 of the projector as extend desktop just adds the projector's resolution onto the right side of the monitor's resolution.

I am finding the monitor resolution width using:

Code: [Select]
sf::VideoMode::getDesktopMode().Width

But is there a way to get the projector's resolution? Because I want to be able to stretch the projector's window to fit the resolution of the 2nd monitor but can't see how to get this resolution programatically. Is there a way to get the full resolution of both screens (1920x1080 + 800x600 = 2720x1080, still 1080 because only the widths are added) and then subtract sf::VideoMode::getDesktopMOde().Width or anything?

I am on windows and this program will only ever be used on windows so is there a way to find it using windows functions?

Thanks,

Poncho

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
Getting resolution of second monitor
« Reply #1 on: August 20, 2011, 03:07:26 pm »
Try something like this:

Code: [Select]
EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, 0);  

BOOL CALLBACK MonitorEnumProc(
  __in  HMONITOR hMonitor,
  __in  HDC hdcMonitor,
  __in  LPRECT lprcMonitor,
  __in  LPARAM dwData
)
{
   // lprcMonitor has the coordinates of this monitor
   return TRUE;
}


http://msdn.microsoft.com/en-us/library/dd162610(VS.85).aspx

poncho

  • Newbie
  • *
  • Posts: 7
    • View Profile
Getting resolution of second monitor
« Reply #2 on: August 20, 2011, 07:49:56 pm »
Okay thanks, I'll have a go at that.

 

anything