Hello all,
There have been quite a few posts, in quite a few places on changing the wallpaper via something like:
Option Explicit
dim wshShell, sUserName, oShell, oFSO, sWinDir
dim wp
Set wshShell = WScript.CreateObject("WScript.Shell")
sUserName = wshShell.ExpandEnvironmentStrings("admin")
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sWinDir = oFSO.GetSpecialFolder(0)
wp(0) = "e:\Documents and Settings\admin\My Documents\Wallpaper\win7paper\Globalization\a1.bmp"
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", wp(0)
oShell.Run "d:\WINDOWS\system32\rundll32.exe user32.dll,UpdatePerUserSystemParameters", 1, True
Using this method, the file must already be in .bmp format which means more disk space and manually performing the conversion from .jpg (or whatever other image format) to .bmp. This is a very undesirable condition of the HTA I am in the process of coding. I can code many types of pretty cool functionality but what I am lacking is the ability to convert the image file the way Windows XP Pro Service Pack 3 does when I right-click a .jpg image and select "Set as desktop background". Furthermore, I do know that when "Select as ..." is selected, Windows XP converts a .jpg file to .bmp and stores it in the hidden folder/file: D:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Wallpaper1.bmp. The actual name of the wallpaper in the registry setting "HKCU\Control Panel\Desktop\Wallpaper" never needs changed because of this.
My question is: Can we reference, in some fashion or form, the "Set as desktop background" click-event from vbs? In other words, can we connect to the file system, set a variable equal to a .jpg file and then tell Visual Basic Script to perform the "Set as desktop background" function, click-event or whatever on that .jpg file?????? This would be so greatly appreciated. I have been doing research upon research and finally have only gotten up to the point where I feel like I have asked the question in just the right way. Thanks in advance :-)
I also did a registry seach and found the key: "HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache\@shell32.dll, -31289 Type: SZ Data: Set as desktop background" to be very interesting. I just have no clue as to how to make this useful from script.
Please do not suggest 3rd party command line utilities and such. Windows XP already has the ability to do what I want, I just need to know how to tell Visual Basic Script to tell Windows XP to do it. Thanks again :-)
Student