Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. changing desktop colour doesn't work

changing desktop colour doesn't work

Scheduled Pinned Locked Moved C#
windows-adminquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DragenGimp
    wrote on last edited by
    #1

    Hi, I'm trying to change the background colour of my desktop. Here's the code I'm using:

    		RegistryKey rkWallColor = Registry.CurrentUser.OpenSubKey("Control Panel\\\\Colors", true);
    		rkWallColor.SetValue("Background", "0 0 64");
    		rkWallColor.Close();
    

    I'm sure that I'm doing it right, but the desktop colour wont change. I've checked the registry key and it has been changed. Am I accessing the wrong key? I'm using windows xp. Can anyone see what I'm doing wrong? Thanks

    P 1 Reply Last reply
    0
    • D DragenGimp

      Hi, I'm trying to change the background colour of my desktop. Here's the code I'm using:

      		RegistryKey rkWallColor = Registry.CurrentUser.OpenSubKey("Control Panel\\\\Colors", true);
      		rkWallColor.SetValue("Background", "0 0 64");
      		rkWallColor.Close();
      

      I'm sure that I'm doing it right, but the desktop colour wont change. I've checked the registry key and it has been changed. Am I accessing the wrong key? I'm using windows xp. Can anyone see what I'm doing wrong? Thanks

      P Offline
      P Offline
      PandemoniumPasha
      wrote on last edited by
      #2

      Changing only the registry values will not change the background color. Have a look at the API: SetSysColors. It is present in user32.dll If you want to change the wallpaper and get related information, have a look at SystemParametersInfo which is also present in user32.dll

      regards :)

      D 1 Reply Last reply
      0
      • P PandemoniumPasha

        Changing only the registry values will not change the background color. Have a look at the API: SetSysColors. It is present in user32.dll If you want to change the wallpaper and get related information, have a look at SystemParametersInfo which is also present in user32.dll

        regards :)

        D Offline
        D Offline
        DragenGimp
        wrote on last edited by
        #3

        Thanks, after turning my computer on this morning the background colour has changed, so it seems as though it is working, just not picking up the changes until a reboot.. I thought I should be able to do it through the registry keys as with changing the wallpaper (Which I'm already doing)? I'll have a look at SetSysColors and see where I get. Thanks

        D 1 Reply Last reply
        0
        • D DragenGimp

          Thanks, after turning my computer on this morning the background colour has changed, so it seems as though it is working, just not picking up the changes until a reboot.. I thought I should be able to do it through the registry keys as with changing the wallpaper (Which I'm already doing)? I'll have a look at SetSysColors and see where I get. Thanks

          D Offline
          D Offline
          DragenGimp
          wrote on last edited by
          #4

          okay, after looking into it, it seems that I need to use a combination of the api, and registry keys. I've got it working wonderfully! Thanks you again for the gentle nudge in the right direction :)

          P 1 Reply Last reply
          0
          • D DragenGimp

            okay, after looking into it, it seems that I need to use a combination of the api, and registry keys. I've got it working wonderfully! Thanks you again for the gentle nudge in the right direction :)

            P Offline
            P Offline
            PandemoniumPasha
            wrote on last edited by
            #5

            Glad to help by the way, my nickname's changed

            regards :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups