different wallpaper for each screen for multi-monitor setups in Windows

拜拜、爱过 提交于 2019-12-01 00:28:56
  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) 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.

    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.)

    OR:

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

    Under HKEY_CURRENT_USER\Control Panel\Desktop set:

    • 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.

    .

    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.

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

    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.

    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.

    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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!