Jump to content
  • Advertisement
Sign in to follow this  
Stroyev

How to get desktop resolution? (Win32)

This topic is 4606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two monitors and extended desktop. True resolution is (2*1280, 1024). But, standart function: GetDeviceCaps(::GetDC(0), DESKTOPHORZRES); and GetSystemMetrics( SM_CXSCREEN ); returned desktop width as 1280.

Share this post


Link to post
Share on other sites
Advertisement
You want to use the EnumDisplayDevices method. Here's a sample:


DISPLAY_DEVICE device;
device.cb = sizeof(DISPLAY_DEVICE);

for(int i = 0; ; i++)
{
if (!::EnumDisplayDevices(NULL, i, ref device, 0))
break;

printf("Enumerated device: (id: %s) (name: %s) (state: %d)\n", device.DeviceID, device.DeviceName, device.StateFlags);

// If it's not connected to the desktop, then ignore it.
if ((device.StateFlags & ATTACHED_TO_DESKTOP) == 0)
continue;

// Get the display mode settings of this device.
DEVMODE devMode;
if (!::EnumDisplaySettings(device.DeviceName, ENUM_CURRENT_SETTINGS, &devMode))
continue;

printf(" Position: (%d, %d) Size: %dx%d\n", devMode.dmPosition.x, devMode.dmPosition.y,
devMode.dmPelsWidth, devMode.dmPelsHeight);
}


Share this post


Link to post
Share on other sites
thanks,

But, I am work in VisualStudio6, and its have very old PlatformSDK :)
Nothing EnumDisplayDevices function :D

Share this post


Link to post
Share on other sites
Quote:
Original post by DMINATOR
ok I have no idea then :(


Create wrap dll (for VisualStudio7) and use answer of Dean Harding :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Stroyev
thanks,

But, I am work in VisualStudio6, and its have very old PlatformSDK :)
Nothing EnumDisplayDevices function :D
So download a new PlatformSDK freely from microsoft. If VC6 won't compile it, download Visual C++ 2005 Express Edition for free (legally) at
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=126678&SiteID=1

-Extrarius

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!