Jump to content

Changing Desktop Wallpaper


Recommended Posts

well... iv read through a bunch of old forums pertaining to this... and i made alot of progress... accept, the desktop still wont refresh with the new image. I saw one suggestion that actually right clicks on the desktop clicks on properties the goes over to desktop and applies the background... but yeah... something about that just seems un-efficent. What im trying to do is to make a lil app that just refreshes my desktop with random images. So far, iv tried the following:

This didnt work at all... it didnt change any reg values, or the desktop... i didnt get any error messages back. I did alot of research on it, and as far as i can tell... its doing exactly what its supposed to do.

DllCall("user32.dll", "SystemParametersInfo", "int", "int", 20, "int", 0, "str", "C:\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Wallpaper1.bmp", "int", 0)

This is the only thing that gets me anywhere... but ofcourse the desktop background image does not update, unless you go into desktop properties and apply it.

RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "ConvertedWallpaper", "REG_SZ", "C:\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Wallpaper1.bmp")

RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "OriginalWallpaper", "REG_SZ", "C:\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Wallpaper1.bmp")

RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper", "REG_SZ", "C:\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Wallpaper1.bmp")

envupdate()

This works perfectly, updates the color immidately... *shrugs and scratches my head*

$COLOR_DESKTOP = 1

$color = 0xFF00FF

$ret = DLLCall("user32.dll","int","SetSysColors","int",1,"int_ptr",$COLOR_DESKTOP,"int_ptr",$color)

I even tried setting the registry values and then running the setsyscolor hoping that it would update the desktop image, but it does not, when the color is set, i guess somewhere there is set that the desktop image will not be displayed. Any help will be greatly appreciated. :-) Thanx in advanced.

Edited by Excalibur
Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

hmm... for some reason, it wouldent let me set it to the temporary bmp that windows makes. thats what the problem was. so much fustration, so little reason. :-P Works like a charm now, thx.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

Neither of these methods worked for me on XP Home, any suggestions / feedback as to OS where

sample code works?

Ended up w/ no background, though if I go into the desktop control panel it displays as if it is set properly.

Changing to a different wallpaper, then applying the changes restores a wallpaper setting.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Got it working - Had a typo --

See the UDF I posted in the Scripts/Scraps Forum that supports updating the image as well as the style (works under xphome and w2k)

Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...