有没有办法可以在C#中更改Windows 10后台设置?
我想更改Windows - >幻灯片显示的背景设置,并设置包含我的图像的目录路径。这样桌面图像就会以幻灯片形式开始变化。
我尝试过的事情:
I want to change the Windows -> Background settings to Slideshow and set a directory path containing my images. So that the desktop images start changing as slideshow.
What I have tried:
I found the following registry keys
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers
key : <pre>SlideshowDirectoryPath1
和
and
Computer\HKEY_CURRENT_USER\Control Panel\Desktop
key:
key :
WallPaper
我也尝试过这个方法..它更新壁纸,但我正在寻找一种方法将其更改为幻灯片。
win32.SystemParametersInfo(SET_DESKTOP_BACKGROUND,0,sFile_FullPath,UPDATE_INI_FILE | SEND_WINDOWS_INI_CHANGE);
任何帮助将不胜感激..谢谢。
I have also tried this method .. it updates the wallpaper but i am looking for a way to change it to slideshow.
win32.SystemParametersInfo(SET_DESKTOP_BACKGROUND, 0, sFile_FullPath, UPDATE_INI_FILE | SEND_WINDOWS_INI_CHANGE);
Any help will be greatly appreciated .. Thanks.
你需要的两个设置:
Two settings in there you need:
SlideshowDirectoryPath1
SlideshowSourceDirectorySet
后者很简单:1
前者更难,因为它不是一个直文件夹,它是加密的。
所以
The later is simple: 1
The former is harder, because it isn't a "straight" folder, it's encrypted.
So
D:\Pictures\Wallpaper\Chinese paintings
结果为
Comes out as
NGAFA8BUg/E0gouOpBhoYjAArADMdSBAuAI160KJpVKMFhZ4rKQ+BpHqcBQMAAAAAAg3MBmKQAwVhxGbwFGclJHAEBQCAQAAv7bfHJOjezEYq4CAAAQxaCAAAAQAAAAAAAAAAAAAAAAAAAAAMMh6AcFAhBAbAwGAwBQYAAHAlBgcAAAAYAwBBEDAAAAAA03RjzIEAMEap5WZzVGIwFWauRXaud2cAQFAJAABA8uv9d04M23RjzoLAAAAurJAAAAABAAAAAAAAAAAAAAAAAAAAUfqqCwQAgGApBgbAUGAzBQZAACAwBQYAkGAuBAdAkGAuBwZAMHAAAAIAMJAAAwJA8uvFCAAAEzUQN1td66/Nyx/DFIjECkOjOXLpBAAAQGAAAAAfAAAAwCAAAwdAkGAuBAZA8GA3BwcA4CApBQbA0GAlBgcAMHApBgdAUGAjBwbA4GA0BgcA8GAsBAcAEGAuBQZAwGAfBwYAcHA1AgbAEDAoBgMAQHA4BQeAUGA3BQeAAAAAAAAAAAAAAAIAAAA
其中是BASE64 PIDL显然。
我没有和他们玩过,所以这一点会由你决定,但这里有一些代码应该有所帮助:保存照片屏幕保护程序设置在哪里? [ ^ ] - Powershell代码大约下降了1/2,但这应该很容易转换为C#。或者有一个命令shell命令将它插入到可能更容易使用的代码下面!
然后你需要在
Which is a BASE64 PIDL apparently.
I've not played with them, so that bit's going to be up to you, but there is some code here that should help: Where are Photo Screensaver settings saved?[^] - the Powershell code is about 1/2 way down, but that should translate to C# reasonably easily. Or there is a command shell command to insert it below that code that might be easier to use!
You then need to set the values under
Computer\HKEY_CURRENT_USER\Control Panel\Personalization\Desktop Slideshow
使幻灯片显示工作。