Results 1 to 3 of 3

Thread: Set Desktop Wallpaper???

  1. #1
    hellswraith
    Guest

    Set Desktop Wallpaper???

    Anyone know how to set the Desktop Wallpaper on a users machine through .Net code yet?

    I tried this (a long shot):
    Microsoft.Win32.UserPreferenceCategory.Desktop = viewAreaPic.Image;

    Didn't work though. Maybe someone has done this or can give me a kick in the right direction...

  2. #2
    Addicted Member
    Join Date
    Mar 2001
    Location
    Devon, UK
    Posts
    181
    This works.

    Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("Control Panel", True)

    Try
    key = key.OpenSubKey("Desktop", True)

    key.SetValue("Wallpaper", "YOUR IMAGE")
    Catch ex As Exception

    End Try
    Wind and waves resolves all problems.

  3. #3
    hellswraith
    Guest
    cim3, thanks for the reply, but that didn't work on my computer.

    I switch the code to C# syntax it is here:
    Code:
    RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel", true);
    
    	try
    	{
    		key = key.OpenSubKey("Desktop", true);
    
    		key.SetValue("Wallpaper", thumbPanel.CurrentThumbPath.ToString());
    	}
    	catch
    	{
    		// Something went wrong.
    	}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width