I’ve been tasked with modifying one of our c++ products to spawn a new window on a specific display in the Windows OS. This is for a client who needs to be able to configure a tiled multi-display visualization, where each display is driven by a separate graphics card on a single computer.
In linux, I can do this easily by starting an X server on each display, then starting multiple instances of the visualization software with the DISPLAY env var set appropriately. However, I’m lost when it comes to doing this in Windows. Any pointers/suggestions/examples?
You’ll need to enumerate all the monitors and check on their mappings on the virtual screen (MSDN).
Monitors are enumerated via a call to EnumDisplayMonitors (MSDN). This will enumerate a series of
HMONITORhandles that you can pass to GetMonitorInfo (MSDN) to get the location of the monitor on the virtual screen.There’s also a whole guide to Multi-Monitor support that may also be worth reading.
About Multiple Display Monitors (Windows) @ MSDN
Some Caveats: Because the virtual screen is a user-controlled mapping, there’s nothing preventing a user from setting up a monitor on the opposite physical side of where the monitor is placed in virtual coordinate space, and vice versa, as well as any number of other weird placement scenarios. Also, some display cards try to assume where the monitor is upon plug-in detection, which may be wrong from your software’s point of view but could be caused by the user not paying attention to which display port maps to a left-hand side (if it is even labeled at all).