SFML community forums

Help => Window => Topic started by: poncho on August 20, 2011, 11:08:12 am

Title: Getting resolution of second monitor
Post by: poncho 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
Title: Getting resolution of second monitor
Post by: omeg 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
Title: Getting resolution of second monitor
Post by: poncho on August 20, 2011, 07:49:56 pm
Okay thanks, I'll have a go at that.