Article ID: 97142 - Last Review: October 26, 2007 - Revision: 2.1 How to Use SystemParametersInfo API for Control Panel Settings
This article was previously published under Q97142 On This PageSUMMARY
The SystemParametersInfo API call can be used to get and set Windows
settings that are normally set from the Desktop by using the Control Panel.
MORE INFORMATION
You can call the SystemParametersInfo API to set and get all the settings
controlled by the Windows Control Panel. Normally a user would have to
choose the Windows Control Panel to view or change system settings such as
granularity, wallpaper, or icon title wrap. Instead of forcing the user to
set things manually using the Control Panel you can have your program call
the SystemParametersInfo API to set them automatically.
Use the following Visual Basic for Windows Declare for the API. Enter it all as one, single line: Here are the formal arguments to the function: uAction system parameter to query or set uParam depends on system parameter lpvParam depends on system parameter fuWinIni WIN.INI update flag The uAction argument can be one of the following constants: CONST SPI_GETBEEP=1 CONST SPI_SETBEEP=2 CONST SPI_GETMOUSE=3 CONST SPI_SETMOUSE=4 CONST SPI_GETBORDER=5 CONST SPI_SETBORDER=6 CONST SPI_GETKEYBOARDSPEED=10 CONST SPI_SETKEYBOARDSPEED=11 CONST SPI_LANGDRIVER=12 CONST SPI_ICONHORIZONTALSPACING=13 CONST SPI_GETSCREENSAVETIMEOUT=14 CONST SPI_SETSCREENSAVETIMEOUT=15 CONST SPI_GETSCREENSAVEACTIVE=16 CONST SPI_SETSCREENSAVEACTIVE=17 CONST SPI_GETGRIDGRANULARITY=18 CONST SPI_SETGRIDGRANULARITY=19 CONST SPI_SETDESKWALLPAPER=20 CONST SPI_SETDESKPATTERN=21 CONST SPI_GETKEYBOARDDELAY=22 CONST SPI_SETKEYBOARDDELAY=23 CONST SPI_ICONVERTICALSPACING=24 CONST SPI_GETICONTITLEWRAP=25 CONST SPI_SETICONTITLEWRAP=26 CONST SPI_GETMENUDROPALIGNMENT=27 CONST SPI_SETMENUDROPALIGNMENT=28 CONST SPI_SETDOUBLECLKWIDTH=29 CONST SPI_SETDOUBLECLKHEIGHT=30 CONST SPI_GETICONTITLELOGFONT=31 CONST SPI_SETDOUBLECLICKTIME=32 CONST SPI_SETMOUSEBUTTONSWAP=33 CONST SPI_SETICONTITLELOGFONT=34 CONST SPI_GETFASTTASKSWITCH=35 CONST SPI_SETFASTTASKSWITCH=36 The UParam argument should be 0 when used with a GET constant, and it should contain the new value of the setting when used with a SET constant. The exceptions to these rules are documented in the Windows version 3.1 Software Development Kit (SDK) help file. When used with a GET constant, the lpvParam argument returns the current value of the setting. When used with a SET constant, it is a NULL. The exceptions to these rules are documented in the Windows version 3.1 SDK help file. The fuWinIni argument updates the WIN.INI file: Example OneOne exception to the rules given above occurs with a call to set or get the icon spacing setting. The following example gives the correct arguments to use to set and get the horizontal spacing:
Example TwoThe example follows the general parameter rules. It demonstrates how to turn icon title wrapping on and off by using SETICONTITLEWRAP.
Example ThreeThis example follows the general parameter rules. It demonstrates how to change your desktop's wallpaper with the SPI_SETDESKWALLPAPER.
APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email

Back to the top
