Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: pball
I finally found a simple way to change the wallpaper via a script. But the last line which calls a dll and is supposed to update the changes does not. Thus the wallpaper is "changed" but the changes won't show until I log out, shut down, or some times refresh the desktop.
REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "c:\WINDOWS\Blue Lace 16.bmp" REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0 REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 2 RUNDLL32.exe user32.dll,UpdatePerUserSystemParametersI'm running XP SP3 and I'm wondering if that dll call still works, since most of the posts I found it in are older.
Also would anyone know the values needed for stretched and centered? Since that is tiled now.

@echo off & setLocal EnableDelayedExpansion
cls
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 2
pushd "%userprofile%\My Documents\My Pictures"
FOR /F "tokens=1 delims= " %%A IN ('DIR *.bmp ^| FIND /c /v ""') DO SET var=%%A
set /a z=%random%%%var+1
for /f "tokens=* delims= " %%a in ('dir /b "%userprofile%\My Documents\My Pictures\*.bmp"') do (
set /a N+=1
if !z! equ !N! REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "%userprofile%\My Documents\My Pictures\%%a"
)
popd
%SystemRoot%\System32\RUNDLL32.exe user32.dll, UpdatePerUserSystemParameters
cls
exit

...
um from what I see that is supposed to find a bmp in the document and setting folder then set it to be the wallpaper. Which doesn't even begin to answer my question at all. I know how to set the wallpaper using the registry now but it won't update the desktop when I do so.

You can ask on Professional Win32 api newsgroup :
news://nntp.aioe.org/comp.os.ms-windows.programmer.win32
or
http://groups.google.com/group/comp...
where it has already been discussed
(they have disassembled all apis and then got all parameters..)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |