Results 1 to 14 of 14

Thread: How can I change the desktop wallpaper?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    How can I change the desktop wallpaper?

    Yes I know it's a very general question, but I have no idea how to do this...
    I'll be happy if someone could help

  2. #2

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    bumpie bump

  3. #3
    Lively Member
    Join Date
    May 2001
    Posts
    96
    Same as in VB6, Do a search for it.

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    well I already searched for the vb6 version of it and it obviously uses windows API functions. I'm looking for a way to do it through .NET classes. That is, if possible at all

  5. #5

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    anyone can give me a hint or something on how to use the framework for this?!

  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    i think you are going to have to use api. an alternate method would be to make a vb6 app with only a main sub and shell the command out to the vb6 app. that would keep your .net pure

    although the api isn' that big a deal in truth most api is cross platform especial stuff like changing the desktop

    i mean what do you think c++ uses win32 api is what it uses for everything
    Magiaus

    If I helped give me some points.

  7. #7
    Lively Member
    Join Date
    May 2001
    Posts
    96
    Found something that might be usefull AllApi.net I would find how to do it in vb6 and then find the api functions that are used and replace them with the All API thing.

  8. #8
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    What is wrong with the search on the forums, it isn't working right....and while we are at it what is up with my post count being reset...

    Anyway, if you can get the search to work, I asked this question a while ago, and got an answer (never got it to work though, maybe you can). It has to do with setting a registry key to the new file.

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    sight, I guess I'll have to wait for the search to be fixed then

    Thanks cogman for the help.In VB6 you do it with SystemParametersInfo, I couldnt find an equivalent for it in .NET....

  10. #10
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I know it is a registry key that you change, and I am looking through a bunch of old code to find it. If I find it I will post it here.

    The problem I had with it though, is it wouldn't take into effect until you logged off or shut down the system...didn't really look into it further though, I ended up not using it at all.

  11. #11
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Found it, it is in C# code...
    VB Code:
    1. private void ImageToWallpaper(string imagepath)
    2. {
    3.    // This will set the desktop wallpaper to the current image.
    4.    RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel", true);
    5.  
    6.    key = key.OpenSubKey("Desktop", true);
    7.  
    8.    key.SetValue("Wallpaper", imagepath);
    9. }

  12. #12
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You might want to add some error trapping, if the user dosen't have access to the registry, I think you will get an exception.

  13. #13

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    thanks hellswraith I will try it... There should be a way to "refresh" the desktop though

  14. #14
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    it is a reg key and you have to update and send a refresh to the desktop i believe. but i don't think it will work without api

    well i was going to tell you to go to this really cool windows regisry site but i lost the link

    sorry
    Magiaus

    If I helped give me some points.

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