Help with changing desktop wallpaper...Almost there.
Hello everyone,
I am using this code below to set the desktop wallpaper. I need a way to actually apply the setting though. It properly sets the image because when you right-click the desktop, select properties, and click on the Desktop tab, it shows the image I set. But not until you click apply on that dialog will it actually change the image. Is there a way to tell windows that there was a change of this registry setting and apply it in code? (the code is in C#, but the only difference between this and VB is the declaration of the registry object)
Please help.
Code:
RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel", true);
try
{
key = key.OpenSubKey("Desktop", true);
key.SetValue("Wallpaper", sPathOfImage);
}
catch
{
// Something went wrong.
MessageBox.Show("Something went wrong");
}