问题描述
我正在使用 C++ 应用程序来管理 Windows 上多台显示器的壁纸,就像 UltraMon 和 DisplayFusion 所做的那样,但有更多选项.
I am working on C++ application to manage wallpapers accross multiple monitors on Windows, like what UltraMon and DisplayFusion do but with more options.
一切正常,但会监控展示位置.
Everthing is working well but monitors placement.
我的桌面上有三台这样排列的显示器(忽略 N°4)
My desktop has three monitors arranged like that (ignore N°4)
但是当我查看UltraMon生成的壁纸文件时,第三个显示器(小的)没有相同的位置:
But when I look at the wallpaper file generated by UltraMon, the thrid monitor (the small one) does not have the same position :
通过使用 EnumDisplayMonitors 和 GetMonitorInfo 函数,我得到了这些数据:
By using EnumDisplayMonitors and GetMonitorInfo functions I get these data :
0: 1920x1080 at 1920x0
1: 1920x1080 at 0x0 primary
2: 800x480 at -800x-480
与我的安排一致,但与壁纸文件不同.
Which corresponds to my arrangement, but differs from the wallpaper file.
如何知道图像在全局墙纸文件中的位置以使其显示在正确的显示器上?我猜 UltraMon 的作者找到了正确的方法,因为它可以完美运行.
How to know where is placed the image in the global wallpaper file to have it displayed on the right monitor ? I guess the author of UltraMon found the right way 'cause it works perfectly.
(我也在 UltraMon 论坛上问过这个问题).
(I asked this question on UltraMon forum too).
推荐答案
感谢 Raymon Chen 引用的文章我想通了.http://blogs.msdn.com/b/oldnewthing/archive/2007/09/24/5083738.aspx
Thanks to the article quoted by Raymon Chen I figured it out.http://blogs.msdn.com/b/oldnewthing/archive/2007/09/24/5083738.aspx
要知道的两件事:
- 在每台显示器上使用不同壁纸的诀窍是构建一个宏壁纸"并将其平铺在桌面上
- 磁贴从主监视器上的 0;0 开始
知道,位于主显示器左侧或顶部的任何显示器都位于壁纸的另一个图块上.
Knowing that, any monitor which is on left or top of the primary monitor is on another tile of the wallpaper.
让我们在图片中看到它:
Let's see it in image :
绿色是实际桌面,它使用四块墙纸图像(红色).
in green we have the actual desktop, which uses four tiles of the wallpaper image (in red).
现在是时候编写代码了!
Now it's time to code that !
这篇关于监视器在 Windows 壁纸上的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!