Windows API to run shuffle

Is there a way to cause a shuffle in the slide show for windows? Preferably what 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 either.

+6
source share
4 answers

Try the following:

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

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

 [Slideshow] Shuffle=1 

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

AD_APPLY_ALL | AD_APPLY_FORCE | AD_APPLY_BUFFERED_REFRESH

+3
source

OH WAIT, just found that you just want to shuffle. Flot2011's answer is the way to go.

You can find the full path to the user's current subject through:

HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Themes \ CurrentTheme

If there is an api for this, it will probably not be shown yet. The best thing I would do if you were to imitate clicking on the β€œNext Desktop” option in the desktop context menu. There are several ways to do this, but I suggest you use the GetDesktopWindow api, simulate a right-click and send the key "n". I'm not quite sure what effect this will achieve, but it should work.

Also take a look at this: http://www.technixupdate.com/keyboard-shortcut-or-hotkey-to-switch-to-next-windows-7-desktop-wallpaper/

+1
source

Registry key

HKEY_CURRENT_USER \ Control Panel \ Personalization \ Desktop Slideshow

contains values ​​that should give you control over several aspects of the function.

0
source

If everyone needs a quick, hacked script, this seems to work for me in PowerShell, unless you mind the delay of a couple of seconds and the windows go down and then back up:

 Function Next-Slide() { $shellApp = New-Object -ComObject Shell.Application $wScript = New-Object -ComObject WScript.Shell # stack.push(...) # I guess this is assuming we aren't on the desktop already... $shellApp.ToggleDesktop(); # This doesn't seem to be needed... #$desktopLoc = $wScript.SpecialFolders('Desktop'); #$wScript.AppActivate($desktopLoc); #Give time to get to the desktop sleep 1; # Hack to make sure something is selected on the desktop # if there is something to select. $wScript.SendKeys('{RIGHT}'); $wScript.SendKeys('{UP}'); $wScript.SendKeys('{LEFT}'); $wScript.SendKeys('{DOWN}'); # Now undo the selection so that we get the desktop context # menu, not the icon one. This toggles selection on desktop. $wScript.SendKeys("^ "); # Open a context menu and select the option to see the next slide $wScript.SendKeys("+{F10}"); $wScript.SendKeys("n"); $wScript.SendKeys("~"); #This is ENTER # Give the key commands time to be read sleep 1; # stack.pop() $shellApp.ToggleDesktop(); } 

Caution: I see that the numlock on / off indicator appears in the lower right corner of the screen when I start it. I do not know why. It can change.

0
source

Source: https://habr.com/ru/post/911575/


All Articles