Sign in to follow this  
Slaru

Display Device and its offset in pixels

Recommended Posts

Slaru    222
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,
                           "SlarusOpenGLWindow,
                           "My window",
                           Mystyle,
                           offsetWidth, offsetHeight,
                           fullWidth, fullHeight,
                           0, 0,
                           hInstance,
                           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
Amadeus    205
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this