Windows 中多显示器设置的每个屏幕都有不同的壁纸 [英] different wallpaper for each screen for multi-monitor setups in Windows

查看:50
本文介绍了Windows 中多显示器设置的每个屏幕都有不同的壁纸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用:

ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,
                                           0, "picturefile", 0)

更换壁纸.

但我想知道是否有任何简单的方法可以在每个屏幕上放置不同的壁纸.

But I'm wondering if there's any simple way to put different wallpapers on each screen.

尽管此功能在 Windows 中并不是标准配置,但有一些外部应用程序(例如ultramon)可以执行此操作.有谁知道它是如何工作的?

This feature isn't standard in windows though, but there are external applications like ultramon that do this. Anyone know how that works?

我认为如果我将两个图像合并为一个然后制作墙纸可能会起作用的方式,但是我仍然需要一种方法来跨越两个屏幕跨越一个图像.

The way I thought it might work if I join the two images together into one and then make that the wallpaper, but then I still need a way to span one image accross both screens.

此外,我如何获取有关显示器设置、每个屏幕的分辨率及其位置的一些信息?就像您在 Windows 中的 gui 显示设置中看到的一样,但是是数字.

Also, how could I grab some info about the monitor setup, the resolution of each screen and their placement? Like what you see in the gui display settings in windows, but in numbers.

推荐答案

  1. 将图像拼接成大图像后,您必须将壁纸模式设置为平铺以使图像跨越桌面(否则它将在每个显示器上重新启动).

  1. After joining the images together into a big image, you have to set the wallpaper mode to tiled to make it so the image spans the desktop (otherwise it will restart on each monitor).

执行此操作的几种方法:

Couple of ways to do this:

a) 使用 IActiveDesktop(这不需要需要使用 Active Desktop,别担心).这是最好的,因为在 Win7 上,新壁纸会淡入.

a) Using IActiveDesktop (which does not require Active Desktop to be used, don't worry). This is nicest as on Win7 the new wallpaper will fade in.

您创建一个 IActiveDesktop/CLSID_ActiveDesktop COM 对象,然后调用 SetWallpaper、SetWallpaperOptions,最后调用 ApplyChanges.(因为我不是 Python 开发人员,所以我不确定您是如何访问 COM 对象的,抱歉.)

You create an IActiveDesktop / CLSID_ActiveDesktop COM object and then call SetWallpaper, SetWallpaperOptions and finally ApplyChanges. (As I'm not a Python dev, I'm not sure exactly how you access the COM object, sorry.)

或:

b) 通过注册表.这不是很好,但效果很好.

b) Via the registry. This isn't as nice, but works well enough.

HKEY_CURRENT_USER\Control Panel\Desktop下设置:

  • TileWallpaper 到 (REG_SZ) 1(即字符串1"而不是数字 1)
  • WallpaperStyle 到 (REG_SZ) 0(即字符串0"而不是数字 0)
  • 然后像之前一样调用 SystemParameterInfo(SPI_SETDESKTOPWALLPAPER...).
  • TileWallpaper to (REG_SZ) 1 (i.e. the string "1" not the number 1)
  • WallpaperStyle to (REG_SZ) 0 (i.e. the string "0" not the number 0)
  • Then call SystemParameterInfo(SPI_SETDESKTOPWALLPAPER...) as you do already.

.

顺便说一下,我正在查看的代码,它使用 IActiveDesktop 并在失败时退回到注册表,通过 SPIF_UPDATEINIFILE |SPIF_SENDCHANGE 作为 SystemParameterInfo 的最后一个参数;您当前正在传递 0,这可能是错误的.

By the way, the code I'm looking at, which uses IActiveDesktop and falls back on the registry if that fails, passes SPIF_UPDATEINIFILE | SPIF_SENDCHANGE as the last argument to SystemParameterInfo; you're currently passing 0 which could be wrong.

EnumDisplayMonitors是用于获取有关显示器的详细信息的 Win32 API,包括它们的屏幕尺寸和相对位置.

EnumDisplayMonitors is the Win32 API for getting details on the monitors, including their screen sizes and positions relative to each other.

该 API 通过您必须提供的回调函数返回其结果.(它为每个监视器调用一次.)我不是 Python 开发人员,所以我不确定如何从 Python 调用这样的函数.

That API returns its results via a callback function that you have to provide. (It calls it once for each monitor.) I am not a Python developer so I'm not sure how you can call such a function from Python.

一个关于Python EnumWindows"的快速谷歌(EnumWindows 是一个常用的 API,它以相同的方式返回结果)发现人们在谈论它,并使用 Lambda 函数进行回调,所以它看起来是可能的,但我将它留给更了解 Python 的人.

A quick Google for "Python EnumWindows" (EnumWindows being a commonly-used API which returns results in the same way) finds people talking about that, and using a Lambda function for the callback, so it looks like it's possible but I'll leave it to someone who knows more about Python.

注意:记住要处理彼此不相邻或彼此不对齐的显示器.您编译的图像可能需要有空白区域,以使所有显示器上的内容都正确排列.如果您移动其中一台显示器并对整个桌面进行 PrtScn 屏幕截图,您就会明白我在结果中的意思.

Note: Remember to cope with monitors that aren't right next to each other or aren't aligned with each other. Your compiled image may need to have blank areas to make things line up right on all the monitors. If you move one of the monitors around and do a PrtScn screenshot of the whole desktop you'll see what I mean in the result.

这篇关于Windows 中多显示器设置的每个屏幕都有不同的壁纸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆