Working with the Windows Registry
Tim Golden
mail at timgolden.me.uk
Fri Jun 27 09:46:35 EDT 2008
teh_sAbEr wrote:
> Great! It works properly now but I have one more question, would
> anyone know how to get the changes to take effect immediately? Like
> some sort of Python way to force the desktop to reload? AFAIK the only
> way that'll happen is if I use the Display Properties dialog box. The
> Registry value is changed properly, its just I don't think the changes
> will take effect until I restart.
Sorry; I missed this one earlier. One way to change the wallpaper
without delving into the registry is the SystemParametersInfo function.
Try the following:
<code>
import win32con
import win32gui
WALLPAPER_BMP = "c:/temp/t.bmp"
win32gui.SystemParametersInfo (
win32con.SPI_SETDESKWALLPAPER,
WALLPAPER_BMP,
win32con.SPIF_SENDCHANGE
)
</code>
The only thing I'm not sure about is whether it will survive
a logoff. If it doesn't I suppose you can always combine it
with the registry technique to make it permanent.
TJG
More information about the Python-list
mailing list