Usually we start fullscreen game using ChangeDisplaySettings to change desktop resolution and then create window with flags WS_EX_APPWINDOW and WS_POPUP. This is fine as long as you are running one display system. If you have 2 monitors connected, ChangeDisplaySettings will change resolution on BOTH of them. Not nice.
So the solution is:
- (probably in config/startup window) use EnumDisplayDevices to obtain list of valid displays (entries like \\.\DISPLAY1 (NVIDIA GeForce 9800 GT))
- when user selects monitor he wants to use, you can change resolution only on that monitor, using ChangeDisplaySettingsEx, passing device name (\\.\DISPLAY1) as the first argument
- but another problem arises -- how can you specify on which screen you want the window to be created? In Windows, both monitors are one big virtual display which resolution is approximately sum of monitors resolutions. You can obtain location and size of each screen using EnumDisplayMonitors. You need to provide your own callback function. Happily for us, IDs of entries are just the same as for EnumDisplayDevices. You'll get list of screens with LPRECTs of them, so you can create window at given (X, Y).
- and others displays are ready to provide useful info during testing, like VS' output (you can detach it outside main VS window)
Comments:
-
Ah! I've always wondered how it's done technically ;) Thanks!
23.05.2010 18:37:00
-
Reg:
The DXGI library for Windows Vista/7 from DirectX 10/11 has support for these things.
23.05.2010 19:37:36