Archive: Changig desktop wallpaper


Changig desktop wallpaper
Hi,

Just trying to change the desktop wallpaper by setting the following reg entries:



WriteRegStr HKCU "Control Panel\Desktop" "ConvertedWallpaper" "$PROGRAMFILES\Waza\waza-1024x768.jpg"
WriteRegStr HKCU "Control Panel\Desktop" "Wallpaper" "$PROGRAMFILES\Waza\waza-1024x768.jpg"
WriteRegStr HKCU "Control Panel\Desktop" "OriginalWallpaper" "$PROGRAMFILES\Waza\waza-1024x768.jpg"
WriteRegStr HKCU "Control Panel\Desktop" "WallpaperStyle" "2"

Well, registry is correctly updated, but the wallpaper does not change. It keeps the old wallpaper.

How can I tell windows to resfresh or to keep the new one ?

Thank you
Matt

PS/ tested on win xp sp2


Use SystemParametersInfo from user32.dll to set the wallpaper:

!define SPI_SETDESKWALLPAPER 20
!define SPIF_SENDCHANGE 2
WriteRegStr HKCU "Control Panel\Desktop" "WallpaperStyle" "2"
System::Call 'user32::SystemParametersInfo(i ${SPI_SETDESKWALLPAPER},i 0,t "$PROGRAMFILES\Waza\waza-1024x768.bmp",i ${SPIF_SENDCHANGE})i.r0'

CF