0

my boss requests me to download the jpg file from the http and change it to the wallpaper periodically, here is my code

dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", "http://defsite.com/wallpaper/wallpaper.jpg", False
xHttp.Send

with bStrm
.type = 1 '//binary
.open
.write xHttp.responseBody
.savetofile "C:\Documents and Settings\Administrator\My Documents\My Pictures\Wallpaper\wallpaper.jpg", 2 '//overwrite
end with

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "c:\windows\system32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True

however, the WshShell.Run can't update on the screen, the OS is XP. Is there any idea to do it?

Kindly Advice!

  • Try changing the wallpaper though writing in the registry. oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", *path to your wallpaper" Not sure if the registry path is correct for XP, but you can find it. – Wasiq Ali Nov 05 '13 at 07:09
  • Setting the path to the wallpaper in the registry will only take effect on next login. I have never known `RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters` to actually work, despite it being the 'accepted' solution – Jobbo Nov 05 '13 at 14:29
  • I'm trying to do something like this Jobbo and ran into this problem of the wallpaper not updating until the next login. Although while developing my script it did seem to update immediately on a few occasions. Have you come across a solution to update immediately yet? – Steve W Mar 04 '15 at 11:12

0 Answers0