Issue with Wallpaper Turning Black After Logout/Login Using SystemParametersInfo in Remote Control

Amal Krishna Jk 25 Reputation points
2025-04-28T07:32:47.17+00:00

Hi, I am remotely controlling a Windows device through an agent. I set the desktop wallpaper using the following APIs:


SystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, m_strWallPaperName, 0);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, m_strWallPaperName, SPIF_SENDCHANGE);

When I first log into the device, the wallpaper is applied correctly. Also, when switching users, the wallpaper updates properly for the next user.

However, if I log out and then log back in (as same or different user), the wallpaper turns black. Interestingly, even when the wallpaper turns black, the registry key that stores the wallpaper path remains correct.

My questions are:

From where does Windows fetch the wallpaper after a user logs back in?

Is there a method (other than directly modifying the registry) to correctly apply the wallpaper even after a full logout/login?

Any insights or suggestions would be highly appreciated. Thank you!

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,765 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.