On X Windows I had a cool 'silent-alarm" reminder script that would change my root window (background) color to solid red, just for a few seconds a few moments before changing it back. Is there a way to do this for Windows XP?

I'm thinking some kind of scheduled task that uses cscript to set registry keys (HKEY_CURRENT_USER\Control Panel\Desktop) . However my attempts don't seem to have any effect. What do I have to signal to read those registry entries and re-draw the desktop?

link|improve this question
feedback

migrated from stackoverflow.com May 1 '11 at 21:47

This question came from our site for professional and enthusiast programmers.

3 Answers

I think that once you modify the wallpaper setting in the registry, you simply need to run

RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

from the command line and the changes should take effect. You need to make sure that your image is a bmp file.

In fact, I just tried this by creating a desktop sized bmp file that was all red. I changed the //HKCU/control panel/desktop/wallpaper key to contain the full pathname to this bitmap. I ran the above command from the command line and the desktop changed to the red bmp that I just created

link|improve this answer
works fine for me to remove the image, but when I tried to change the Background color in "HKCU\Control Panel\Colors\Background" it does not do it. – Peter Hahndorf Jan 7 '10 at 11:38
feedback

this isn't as cool as actually spending time writing code, but there's a pretty useful system util called bginfo that embeds info into the desktop's background. it's fairly configurable with all sorts of command-line options. no, i didn't write it.

link|improve this answer
feedback

This does changes the background via command line. Just save this as a bat file. Use bmp or you have to refresh. Also sets the wallpaper to be stretched. If you take out the wallpaperstyle line it will automatically be centered.

@echo off
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "" /f 
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "C:\[LOCATION OF WALLPAPER HERE]" /f 
reg delete "hkcu\Software\Microsoft\Internet Explorer\Desktop\General" /v WallpaperStyle /f
reg add "hkcu\control panel\desktop" /v WallpaperStyle /t REG_SZ /d 2 /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 
exits
link|improve this answer
feedback

Your Answer

 
or
required, but never shown