Discussion:
Change wallpaper on the fly
(too old to reply)
Dave "Crash" Dummy
2014-10-15 14:31:11 UTC
Permalink
I know of several scripts for changing the desktop wallpaper, but the
change does not take effect until the next login. I long for instant
gratification. Is there a way to make the change take effect immediately?
--
Crash

Life is short. Eat dessert first.
JJ
2014-10-15 19:31:39 UTC
Permalink
Post by Dave "Crash" Dummy
I know of several scripts for changing the desktop wallpaper, but the
change does not take effect until the next login. I long for instant
gratification. Is there a way to make the change take effect immediately?
This requires calling the SystemParametersInfo Win32 API function which is
not accessible from VBScript. You can use PowerShell or AutoIt instead.

PowerShell example:
<http://stackoverflow.com/a/19732915/1510085>

AutoIt example:
<http://www.autoitscript.com/forum/topic/52117-wallpaper-changing/>

Note: PowerShell program loading is much slower than the VBScript
(WSCRIPT/CSCRIPT) and AutoIt interpreter programs.
Dave "Crash" Dummy
2014-10-15 20:05:50 UTC
Permalink
Post by JJ
Post by Dave "Crash" Dummy
I know of several scripts for changing the desktop wallpaper, but the
change does not take effect until the next login. I long for instant
gratification. Is there a way to make the change take effect immediately?
This requires calling the SystemParametersInfo Win32 API function which is
not accessible from VBScript. You can use PowerShell or AutoIt instead.
<http://stackoverflow.com/a/19732915/1510085>
<http://www.autoitscript.com/forum/topic/52117-wallpaper-changing/>
Note: PowerShell program loading is much slower than the VBScript
(WSCRIPT/CSCRIPT) and AutoIt interpreter programs.
Thanks. I don't want to do it badly enough to install new scripting
languages.
--
Crash

"It is not necessary to change. Survival is not mandatory."
~ W. Edwards Deming ~
Auric__
2014-10-16 05:41:45 UTC
Permalink
Post by Dave "Crash" Dummy
Post by JJ
Post by Dave "Crash" Dummy
I know of several scripts for changing the desktop wallpaper, but the
change does not take effect until the next login. I long for instant
gratification. Is there a way to make the change take effect
immediately?
This requires calling the SystemParametersInfo Win32 API function which
is not accessible from VBScript. You can use PowerShell or AutoIt
instead.
<http://stackoverflow.com/a/19732915/1510085>
<http://www.autoitscript.com/forum/topic/52117-wallpaper-changing/>
Note: PowerShell program loading is much slower than the VBScript
(WSCRIPT/CSCRIPT) and AutoIt interpreter programs.
Thanks. I don't want to do it badly enough to install new scripting
languages.
It *might* be possible using rundll. I'm not interested enough to try it
myself, however.
--
Science should be taught in schools, by real professors using real
textbooks and real scientific principles, not by television writers
using fictional technologies and pathological regurgitation of trendy
scientific catch phrases from news stand magazines like New Scientist.
R.Wieser
2014-10-16 08:23:31 UTC
Permalink
Dave, the below link might ne relevant to you (I got it as the first result
when googling "rundll change wallpaper").

http://superuser.com/questions/442185/how-do-i-change-wallpaper-real-time-re
gedit-commands

Regards,
Rudy Wieser
Post by Dave "Crash" Dummy
I know of several scripts for changing the desktop wallpaper, but the
change does not take effect until the next login. I long for instant
gratification. Is there a way to make the change take effect immediately?
--
Crash
Life is short. Eat dessert first.
Dave "Crash" Dummy
2014-10-16 10:43:27 UTC
Permalink
Post by R.Wieser
Dave, the below link might ne relevant to you (I got it as the first
result when googling "rundll change wallpaper").
http://superuser.com/questions/442185/how-do-i-change-wallpaper-real-time-re
gedit-commands
Thanks to you and Auric__. The rundll script is one I tried without
success. I even changed all the images to BMP.
(I always Google before flaunting my ignorance here.)
--
Crash

Half the people in the world are below average.
JJ
2014-10-16 12:55:58 UTC
Permalink
Post by Dave "Crash" Dummy
Thanks to you and Auric__. The rundll script is one I tried without
success. I even changed all the images to BMP.
(I always Google before flaunting my ignorance here.)
RUNDLL/RUNDLL32 is really not a universal DLL function caller. It has its
own function call specification. i.e.:

Argument #1:
[Integer] Window handle (the RUNDLL invisible window). This always varies
and not specifiable via RUNDLL command line.

Argument #2:
[Integer] Module handle (the RUNDLL EXE module).
This is 0x01000000 for 32-bit RUNDLL or 0x0000000100000000 for 64-bit
RUNDLL. This argument is not specifiable via RUNDLL command line.

Argument #3:
[Pointer] Parameter string to be passed to the function (taken from RUNDLL
command line; after the function name). Although this argument is
specifiable via RUNDLL command line, its type would always be a string and
the value passed to the DLL function is the pointer to the string, so it
always varies.

Argument #4:
[Integer] Window display command (e.g. normal, maximized, etc.). This value
is taken from the inherited window display command of the RUNDLL process, so
it's not specifiable via RUNDLL command line. The value is equal to the
second parameter of the VBScript Run method of WshShell object.

For example, if you have this RUNDLL command line...

RUNDLL module.dll,TheFunction abc 123

RUNDLL will call "TheFunction" like this:

TheFunction(Window, Module, Parameters, ShowCmd);

Where:

Window = (varies)
Module = (0x01000000 or 0x0000000100000000)
Parameters = Pointer to command line parameter: " abc 123"
ShowCmd = (inherited)

Also, RUNDLL doesn't translate the function parameters in any way. Take for
example, from the superuser.com question mentioned by R.Wieser. i.e.:

RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

In this case, the actual 3rd function parameter (argument #3) would be a
pointer to (no quote) " ,1 ,True" string.

RUNDLL won't translate number strings to integer, nor "true"/"false" boolean
to integer 1 or 0.

Most RUNDLL compatible DLL functions have their names appended with
"_RunDll" or "RunDll". Non-RUNDLL DLL functions may work if the function
expects no argument, or has lesser number of arguments with matching type.
Auric__
2014-10-17 05:09:49 UTC
Permalink
Post by JJ
Post by Dave "Crash" Dummy
Thanks to you and Auric__. The rundll script is one I tried without
success. I even changed all the images to BMP.
(I always Google before flaunting my ignorance here.)
RUNDLL/RUNDLL32 is really not a universal DLL function caller.
I wrote my own replacement for rundll some time back because its limitations
bothered me, and doing so was... a bit tricky. Mine *is* universal: as long
as it can find the library and the chosen function in said library, it will
at least TRY to run it. (Also, it understands concepts like "numbers".)

(Sorry, no links -- it's published under my real name.)
--
Think creatively; don't limit yourself to the mundane.
R.Wieser
2014-10-16 20:04:19 UTC
Permalink
Hello Dave,
Post by Dave "Crash" Dummy
(I always Google before flaunting my ignorance here.)
My apologies. I only realized after posting (as always, too late) that I
sounded a bit presumptious there.

The mentioning of google, the search term I used and where I found the link
I posted was just to give you a chance to find the other related messages
(they looked promising to me).

Regards,
Rudy Wieser
Post by Dave "Crash" Dummy
Half the people in the world are below average.
And at least three-quarters think they are above. :-)
Post by Dave "Crash" Dummy
Post by R.Wieser
Dave, the below link might ne relevant to you (I got it as the first
result when googling "rundll change wallpaper").
http://superuser.com/questions/442185/how-do-i-change-wallpaper-real-time-re
Post by Dave "Crash" Dummy
Post by R.Wieser
gedit-commands
Thanks to you and Auric__. The rundll script is one I tried without
success. I even changed all the images to BMP.
(I always Google before flaunting my ignorance here.)
--
Crash
Half the people in the world are below average.
Dave "Crash" Dummy
2014-10-16 21:14:55 UTC
Permalink
Post by Dave "Crash" Dummy
I know of several scripts for changing the desktop wallpaper, but the
change does not take effect until the next login. I long for instant
gratification. Is there a way to make the change take effect
immediately?
Once satisfied that I couldn't do it directly with script, I went
looking for a command line utility that I could run from the script. I
found it here:

http://download.cnet.com/Command-Line-Wallpaper-Changer-Portable/3000-2336_4-10804844.html

Although written in 2007, it works in Windows 7 x64 and Windows 10
technical preview. If you don't want to navigate the CNet installation
minefield, I've put it up on my server.

http://crash.thedatalist.com/download/CLWCP.zip
Just unzip into a folder and read the Readme file.

It's legal:

<quote>
Distribution
°~~~~~~~~~~~~°
This freeware version may be freely distributed by any way, copied,
published on the Internet software archives, public FTP servers.
</quote>

If anyone is curious about why I want this capability, I'll explain. I
have a full screen HTA that I run like an active desktop. Among other
things, the background is selectable. The problem with this arises when
a transparent taskbar is in use. It is transparent to the system desktop
wallpaper, not the HTA background. To overcome this, I have to be able
to set the system desktop to match when I change the HTA background.
Here are some half scale snapshots that illustrate the situation.

When system wallpaper agrees with script background
Loading Image...

When system wallpaper is different
Loading Image...

Thank you all for your help.
--
Crash

Today is the first day of the rest of your life,
and there's not a damned thing you can do about it.
Loading...