Set up Windows environment with python

Thomas Heller theller at python.net
Thu Sep 29 11:12:01 EDT 2005


"Jim" <mrmaple at gmail.com> writes:

> My company resells windows machines, and we install our software, and
> do a bunch of customization to make sure that all the desktop settings
> are optimal...  we adjust the screen resolution, color depth, and
> referesh rate,  remove shadows from menus and the mouse pointer, set
> the power management options, disable the screensaver, etc... (very
> long list)
>
> I've started doing most of what I want with ctypes:
>
> def disableShadows():
>     # constants taken from WinUser.h in the PlatformSDK
>     SPI_SETCURSORSHADOW = 0x101B
>     rv =
> ctypes.windll.user32.SystemParametersInfoA(SPI_SETCURSORSHADOW, 0,
> False, win32con.SPIF_SENDWININICHANGE)
>
>     # remove shadows from menus
>     SPI_SETDROPSHADOW = 0x1025
>     rv = ctypes.windll.user32.SystemParametersInfoA(SPI_SETDROPSHADOW,
> 0, False, win32con.SPIF_SENDWININICHANGE)
>
> But I'm finding that none of the changes seem to be permanent.  I'm
> wondering if I need to start changing the current Explorer theme
> information instead, or go right to the registry and start changing
> values.
>
> Desktop wallpaper changes work, but they aren't permanent... rebooting
> restores the previous desktop wallpaper.
>
> Does anyone have any experience with this sort of system preperation
> scripting?

>From looking at the MSDN docs, it seems you have to add
SPIF_UPDATEINIFILE (Writes the new system-wide parameter setting to the
user profile) to the last argument.

Thomas



More information about the Python-list mailing list