Windows API to trigger wallpaper shuffle

Issue

Is there a way to trigger a shuffle in windows wallpaper slideshow?
Preferably something I can use from .net

EDIT: so I’m trying to use the IActiveDesktop interface, I got it from here, I tried to use it like this:

public static IActiveDesktop GetActiveDesktop()
{
    Type typeActiveDesktop = Type.GetTypeFromCLSID(new Guid("{75048700-EF1F-11D0-9888-006097DEACF9}"));
    return (IActiveDesktop) Activator.CreateInstance(typeActiveDesktop);
}

and then calling it like this:

IActiveDesktop dt = GetActiveDesktop();
dt.ApplyChanges(AD_APPLY.ALL | AD_APPLY.FORCE | AD_APPLY.BUFFERED_REFRESH);

nothing happens when I run the code, no errors too.

Solution

Try the following:

Your theme located in C:\Users\USERNAME\AppData\Local\Microsoft\Windows\Themes\.theme

Open the .theme file and update a Shuffle flag in the [Slideshow] section:

[Slideshow]     
Shuffle=1

Then use IActiveDesktop interface to reload theme, call ApplyChange with the following parameters:

AD_APPLY_ALL | AD_APPLY_FORCE | AD_APPLY_BUFFERED_REFRESH

Answered By – Flot2011

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published