Moving a full-screen window to an additional monitor using Win32 / SDL

I am using SDL 1.2.14 and I found a case where I need to choose which monitor receives a full screen window. With Xorg, I discovered that Xinerama can do this work using the SDL_VIDEO_FULLSCREEN_HEAD environment variable, however I could not find something similar for Win32.

A full-screen window is always created on the main monitor, and since SDL 1.2 does not support (SDL 1.3, but it is unstable), the API can choose which monitor should be used on Win32, I wonder if it is possible to programmatically move a full-screen window to an additional monitor using the Win32 API after its creation.

I can get Win32 base descriptors for window / context.

+5
source share
1 answer

Raymond Chen wrote a useful article on how to switch an application between windowed and full screen . The important part for you will be this section of code:

GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mi))

This retrieves the monitor information for a particular monitor, but uses the value returned from MonitorFromWindowto select the monitor that the current window is on. There are several other ways to select a monitor, for example, providing an X, Y coordinate or listing them (using EnumDisplayMonitors(...)).

GetMonitorInfo(...)passes a MONITORINFOback, which contains the relative position and size of the display, which you can use to position the full-screen window.

The full API is described in detail on MSDN .

+3

All Articles