使用 Win32/SDL 将全屏窗口移动到辅助监视器
我正在使用 SDL 1.2.14,并且我发现了一种情况,我需要能够选择哪个显示器获得全屏窗口。对于 Xorg,我发现 Xinerama 可以使用 SDL_VIDEO_FULLSCREEN_HEAD 环境变量来完成这项工作,但是,我一直无法为 Win32 找到类似的东西。
全屏窗口始终在主监视器上创建,并且由于 SDL 1.2 不(SDL 1.3 可以,但不稳定)提供 API 来选择在 Win32 上使用哪个监视器,我想知道是否可以以编程方式移动创建后使用 Win32 API 将全屏窗口显示到辅助监视器。
我能够获取窗口/上下文的底层 Win32 句柄。
I am using SDL 1.2.14, and I've found a case where I need to be able to select which monitor gets the fullscreen window. With Xorg, I found Xinerama could do the job using the SDL_VIDEO_FULLSCREEN_HEAD environment variable, however, I've been unable to find something similar for Win32.
The fullscreen window is always created on the primary monitor, and since SDL 1.2 does not (SDL 1.3 can, but it's not stable) provide the API to select which monitor is to be used on Win32, I wonder if it's possible to programmatically move the fullscreened window to the secondary monitor using Win32 API after it has been created.
I am able to get the underlying Win32 handles for the window/context.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Raymond Chen 撰写了一篇关于如何在窗口和全屏之间切换应用程序的有用文章。对您来说重要的部分是代码的这一部分:
这获取特定监视器的监视器信息,但使用从
MonitorFromWindow
返回的值来选择窗口当前所在的监视器。还有其他几种选择监视器的方法,例如提供 X、Y 坐标或枚举它们(使用EnumDisplayMonitors(...)
)。GetMonitorInfo(...)
将MONITORINFO
传回,其中包含显示器的相对位置和大小,您可以使用它来定位全屏窗口。完整的 API 详细信息请参见 MSDN。
Raymond Chen wrote a useful article on how to switch an application between windowed and full screen. The important part for you would be this section of the code:
This gets the monitor information for a specific monitor, but uses the value returned from
MonitorFromWindow
to pick the monitor on which the window currently resides. There are several other methods of picking a monitor, such as providing an X,Y coordinate, or enumerating them (usingEnumDisplayMonitors(...)
).GetMonitorInfo(...)
passes aMONITORINFO
back out, which contains the relative position and size of the display, which you can use to position your full-screen window.The full API is detailed on MSDN.