3

As you know, since a few versions, Windows allows you to set multiple wallpapers that rotate automatically. I'm creating a program to sync my wallpapers over my computers and I'd like to know if it's possible not to set one wallpaper (as a lot of posts show how to do), but multiple ones, as if I went to Personalize > Wallpaper > Select more than one.

I could of course use a timer to change it but it would make the software heavier and if Windows has a way to do it properly it would be way better.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
Thomas Kowalski
  • 1,995
  • 4
  • 20
  • 42
  • Last time I looked at this, the APIs for setting the wallpaper were *extremely* limited. All you get is `SPI_SETDESKWALLPAPER` used with `SystemParametersInfo`, which doesn't get you very far. You don't even have the option of specifying the display style (i.e., tile, stretch, center, etc.). It seems the only option is editing the registry directly—ugh! – Cody Gray - on strike Jan 10 '16 at 13:41
  • So basically, somewhere in the registry, there is a key with all the wallpapers and such ? – Thomas Kowalski Jan 10 '16 at 14:06
  • Yes. There is [sample code](https://code.msdn.microsoft.com/windowsdesktop/cssetdesktopwallpaper-2107409c) on MSDN. I'm not sure as to its quality, I just found it with a quick Google search. But it should get you started. – Cody Gray - on strike Jan 10 '16 at 14:08
  • Well it uses a key that currently contains `C:\Users\Thomas\AppData\Roaming\Microsoft\Windows\Themes` and the folder only contains one wallpaper, not two (I've got two wallpapers set)... So I guess I'll have to find something else. – Thomas Kowalski Jan 10 '16 at 14:27
  • It seems you can do it using [`IDesktopWallpaper`](https://msdn.microsoft.com/en-us/library/windows/desktop/hh706946(v=vs.85).aspx) interface. – Reza Aghaei Jan 10 '16 at 18:25
  • @RezaAghaei this looks great. I just hope I can find a way to make it work in another language than c++ – Thomas Kowalski Jan 11 '16 at 12:45

2 Answers2

4

As Reza Aghaei noted in the comments, starting with Windows 8 you can set per-monitor wallpaper programmatically using the IDesktopWallpaper::SetWallpaper COM call

There's actually a complete example given on a question concerning a different topic (how to instantiate an instance when all you know is the COM interface):

That answer in turn gives credit to an open source project

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
0

You can use Wallpaper Engine. It allows you to set an individual video for each of your monitors, or choose one from the Steam Workshop (as well as a few other features).

You can make a video out of the pictures you have and upload that to Wallpaper Engine. It's $4 on Steam.

Byte11
  • 204
  • 4
  • 12
  • This "answer" reads more like an advertisement. Can you share your relationship with the program (developer, other employee, user, or just found it through search)? – Ben Voigt Jan 14 '19 at 03:42
  • Besides that, the question asked how to do it programmatically. – Ben Voigt Jan 14 '19 at 03:43
  • 1
    I have no relation to it whatsoever. I just really like the program and it can do everything that his program can do, so I thought it would be a good answer to the question. – Byte11 Jan 14 '19 at 06:05