如何以编程方式更改/设置锁定屏幕背景图像(使用 VB.NET、C# 或 Visual C++)?我使用的是 Win 10 Pro 并拥有 Visual Studio 2017 Pro。
我在网上查了一下,但大多数解决方案似乎都不起作用。例如:
- Both 多次更改 Windows 10 锁定屏幕图像 C# WPF https://stackoverflow.com/questions/48319648/change-win-10-lockscreen-image-mutiple-times-c-sharp-wpf and 在 C# 中更改 Windows 锁定屏幕背景图像 https://stackoverflow.com/questions/27492434/change-windows-lock-screen-background-image-in-c-sharp提供示例代码,但导入
System.Windows.Media.Imaging
, Windows.Storage
, Windows.Storage.Streams
, Windows.System.UserProfile
粘贴代码时找不到。我需要添加具体参考文献吗?
-
锁屏个性化示例 https://code.msdn.microsoft.com/windowsapps/Personalization-App-sample-9ebfe147看起来很有希望,但打开解决方案/项目文件后,Visual Studio 会抛出错误,指出提供的格式不可读。
大多数来源(也Windows 开发中心 - 锁屏类 https://learn.microsoft.com/en-us/uwp/api/windows.system.userprofile.lockscreen)似乎建议
Windows.System.UserProfile.LockScreen.SetImageFileAsync(file);
但我显然缺少特定的命名空间/导入/包来使其运行。
任何帮助,将不胜感激。
我找到了使用这个问题的更简单的方法Windows 10 Pro锁屏大规模更改 https://superuser.com/questions/1254728/windows-10-pro-lockscreen-mass-change。我需要做的就是设置下面的注册表项
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP
DesktopImagePath
DesktopImageUrl
LockScreenImagePath
LockScreenImageUrl
到所需图片的路径,无需 UWP 或 WPF。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)