Display Device and its offset in pixels

Started by
2 comments, last by Slaru 18 years, 9 months ago
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
Advertisement
They should be set to zero.
<span class="smallfont">That is not dead which can eternal lieAnd with strange aeons even death may die.   -- "The Nameless City" - H. P. Lovecraft</span>
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]
----------------------------"Whatever happens, happens..." - Spike"Only the strong survive, if they choose to leave those weaker than themselves behind." - Myself
Thanks, that looks like what I need.

This topic is closed to new replies.

Advertisement