How to change lockscreen wallpaper by using Windows SDK (C++) or modifying registry?

Jiakang Li 20 Reputation points
2023-05-09T04:03:47.9333333+00:00

Hi all.

My Windows version is Windows 10 22H2 19045.2846, and I'd like to change my lockscreen wallpaper by using Windows SDK (or dll function), but I can't find any function for it.

I want to get a function, which is equal to [Setting]-[Personalize]-[Lockscreen Interface]-[Select picture] operation.

How can I implement this functionality (not using UWP/C# but C++ or C)?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,949 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,476 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,595 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 9,346 Reputation points Microsoft Vendor
    2023-05-09T07:05:48.65+00:00

    Hello,

    Welcome to Microsoft Q&A!

    According to your description (Windows SDK) and the tag (Windows App SDK), whether you want to use winui3 project (Windows App SDK) or desktop project (Windows SDK)?

    For desktop project:

    According to the Doc: Personalization CSP

    I suggest you could try to change the registry by creating a new key in the

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

    For more details, you could refer to the threads:

    https://social.technet.microsoft.com/Forums/windows/zh-CN/8e02368a-3ce9-4e08-b596-7e10483a6679/3245231574300532716926495?forum=WinServerPreviewZHCN

    https://stackoverflow.com/a/51785913

    For winui3 project:

    You could follow Castorix31's suggestion. And you could refer to the sample: Lock screen personalization sample

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Castorix31 82,326 Reputation points
    2023-05-09T06:01:23.0933333+00:00
    1 person found this answer helpful.

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more