Jump to content
  • Advertisement
Sign in to follow this  

Display Device and its offset in pixels

This topic is 4883 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

Hello, I want to create a fullscreen window on a specific monitor for OpenGL. I know the specific device (got it from EnumDisplayDevices()). I can set the device to the right resulution that I want. Now, when I create the window with CreateWindow(), how do I know the offset at which to place the window?
HWND hWnd = CreateWindowEx(MyExstyle,
                           "My window",
                           offsetWidth, offsetHeight,
                           fullWidth, fullHeight,
                           0, 0,
How do I know with what to set the offsetWidth and offsetHeight values? I hope someone understands what I am trying to do here. Any help is appreciated. [EDIT] It is late here, so I will check this thread probably in about 9 hours when I wake up. Untill then, I hope someone can help. Slaru

Share this post

Link to post
Share on other sites
You can either use the dmPosition member of the DEVMODE structure you get from EnumDisplaySettings called with the ENUM_CURRENT_SETTINGS or ENUM_REGISTRY_SETTINGS flags set..

Or you can use EnumDisplayMonitors instead.

It will give you an HMONITOR value in the callback function you provide.

Use GetMonitorInfo on this handle value passing in a MONITORINFO or MONITORINFOEX structure. I use the EX version since it also contains a member for the Device name if you want to use EnumDisplayDevices or EnumDisplaySetting later on as usual.

The rcMonitor RECT member of the MONITORINFO structure contains the position values you need for the offset.

I use the EnumDisplayMonitors way currently due to the issues stated in a previous post by me: here

Hope it helps.

[Edited by - Amadeus on July 2, 2005 10:43:25 AM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!