Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically Change Windows 10 Lock Screen Background (on Desktop)

How can I programmatically change/set the lock screen background image (using VB.NET, C# or Visual C++)? I am using Win 10 Pro and have Visual Studio 2017 Pro.

I've had a look online but most solutions don't seem to work. For example:

  1. Both Change Win 10 Lockscreen Image Mutiple Times C# WPF and Change Windows Lock Screen background image in C# provide sample code but the imports System.Windows.Media.Imaging, Windows.Storage, Windows.Storage.Streams, Windows.System.UserProfile cannot be found when I paste the code. Do I need to add specific references?
  2. Lock screen personalization sample looks very promising but upon opening the solution/project file, Visual Studio throws an error saying that the provided format is unreadable.

Most sources (also Windows Dev Center - LockScreen Class) seem to suggest
Windows.System.UserProfile.LockScreen.SetImageFileAsync(file);
but I am apparently missing the specific namespace/import/package to make it run.

Any help would be appreciated.

like image 913
ThomasT Avatar asked Aug 10 '18 08:08

ThomasT


People also ask

How do you make your Lock screen wallpaper change automatically Windows 10?

Customize your lock screen imageSelect Start > Settings . Select Personalization > Lock screen . Select the list for Background, then do one of the following: Select Windows spotlight for beautiful photography that displays automatically.

Where is the Windows 10 Lock screen wallpaper stored?

Now, we need to find the folder containing the lock screen photos. For this, navigate to This PC > (C:) > Users > UserName > AppData > Local > Packages > Microsoft. Windows.


1 Answers

I've found an easier way using this question Windows 10 Pro lockscreen mass change. All I need to do is set the registry entries under

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP

  • DesktopImagePath
  • DesktopImageUrl
  • LockScreenImagePath
  • LockScreenImageUrl

to the path of the desired picture, which works without UWP or WPF.

like image 106
ThomasT Avatar answered Sep 17 '22 12:09

ThomasT