SystemParametersInfo

  BOOL SystemParametersInfo(wAction, wParam, lpvParam, fWinIni)    
  UINT wAction; /* system parameter to query or set */
  UINT wParam; /* depends on wAction parameter */
  PVOID lpvParam; /* depends on wAction parameter */
  UINT fWinIni; /* WIN.INI update flag */

The SystemParametersInfo function queries or sets system-wide parameters. This function can also update the WIN.INI file while setting a parameter, depending on the value of the fWinIni parameter.

Parameters

wAction

Specifies the system-wide parameter to query or set, which may be one of the following:

Value Meaning

SPI_GETBEEP  
  Retrieves a BOOL value that indicates whether the warning beeper is on or off.
SPI_GETBORDER  
  Retrieves the border multiplier factor that determines the width of a window's sizing border.
SPI_GETGRIDGRANULARITY  
  Retrieves the current granularity value of the desktop sizing grid.
SPI_GETICONTITLELOGFONT  
  Retrieves the logical font information for the current icon-title font.
SPI_GETICONTITLEWRAP  
  Determines whether icon title wrapping is on or off.
SPI_GETKEYBOARDDELAY  
  Retrieves the keyboard repeat-delay setting.
SPI_GETKEYBOARDSPEED  
  Retrieves the keyboard repeat-speed setting.
SPI_GETMENUDROPALIGNMENT  
  Determines whether popup menus are left aligned or right aligned relative to the corresponding menu-bar item.
SPI_GETMOUSE  
  Retrieves the mouse speed and the x and y mouse threshold values.
SPI_GETSCREENSAVEACTIVE  
  Retrieves a BOOL value that indicates whether screen saving is on or off.
SPI_GETSCREENSAVETIMEOUT  
  Retrieves the screen-saver timeout value.
SPI_ICONHORIZONTALSPACING  
  Sets the width (in pixels) of an icon cell.
SPI_ICONVERTICALSPACING  
  Sets the height (in pixels) of an icon cell.
SPI_LANGDRIVER  
  Identifies the language driver.
SPI_SETBEEP  
  Turns the warning beeper on or off.
SPI_SETBORDER  
  Sets the border multiplier factor that determines the width of a window's sizing border.
SPI_SETDESKPATTERN  
  Sets the current desktop pattern by causing the Windows USER.EXE program to read the “Pattern=” parameter from the WIN.INI file.
SPI_SETDESKWALLPAPER  
  Specifies the filename that contains the bitmap to be used as the desktop wallpaper.
SPI_SETDOUBLECLKHEIGHT  
  Sets the height of the rectangle within which the second click of a double click must fall for it to be registered as a double click.
SPI_SETDOUBLECLICKTIME  
  Sets the double-click time for the mouse. The double-click time is the maximum number of milliseconds that may occur between the first and second clicks of a double-click.
SPI_SETDOUBLECLKWIDTH  
  Sets the width of the rectangle within which the second click of a double click must fall for it to be registered as a double click.
SPI_SETGRIDGRANULARITY  
  Sets the granularity of the desktop sizing grid.
SPI_SETICONTITLEWRAP  
  Turns icon title wrapping on or off.
SPI_SETKEYBOARDDELAY  
  Sets the keyboard repeat-delay setting.
SPI_SETKEYBOARDSPEED  
  Sets the keyboard repeat-speed setting.
SPI_SETMENUDROPALIGNMENT  
  Sets the alignment value of popup menus.
SPI_SETMOUSE  
  Sets the mouse speed and the x and y mouse threshold values.
SPI_SETMOUSEBUTTONSWAP  
  Swaps or restores the meaning of the left and right mouse buttons.
SPI_SETSCREENSAVEACTIVE  
  Sets the state of the screen saver.
SPI_SETSCREENSAVETIMEOUT  
  Sets the screen-saver timeout value.

wParam

This parameter depends on the wAction parameter. See the following Comments section for details.

lpvParam

This parameter depends on the wAction parameter. See the following Comments section for details.

fWinIni

If a system parameter is being set, this parameter specifies whether the WIN.INI file is updated, and if so, whether the WM_WININICHANGE message is broadcast to all top-level windows to notify them of the change. This parameter can be one of the following values:

Value Meaning

SPIF_UPDATEINIFILE  
  Writes the new system-wide parameter setting to the WIN.INI file.
SPIF_SENDWININICHANGE  
  Broadcasts the WM_WININICHANGE message after updating the WIN.INI file.

Return Value

The return value is TRUE if the function is successful, or FALSE if an error occurred.

Comments

This function is intended for applications such as Control Panel that allow the user to customize the Windows environment.

The following table describes the wParam and lpvParam parameters for each SPI_ constant:

Constant wParam lpvParam

SPI_GETBEEP 0 Points to a BOOL variable that receives TRUE if the beeper is on, FALSE if it is off.
SPI_GETBORDER 0 Points to an integer variable that receives the border multiplier factor.
SPI_GETGRIDGRANULARITY 0 Points to an integer variable that receives the grid-granularity value.
SPI_GETICONTITLELOGFONT Specifies the size of a LOGFONT structure. Points to a LOGFONT structure that receives the logical font information.
SPI_GETICONTITLEWRAP 0 Points to a BOOL variable that receives TRUE if wrapping if on, FALSE if wrapping is off.
SPI_GETKEYBOARDDELAY 0 Points to an integer variable that receives the keyboard repeat-delay setting.
SPI_GETKEYBOARDSPEED 0 Points to a WORD variable that receives the current keyboard repeat-speed setting.
SPI_GETMENUDROPALIGNMENT 0 Points to a BOOL variable that receives TRUE if popup menus are right aligned, FALSE if they are left aligned.
SPI_GETMOUSE 0 Points to an integer array where lpiMouse[0] receives xMouseThreshold, lpiMouse[1] receives yMouseThreshold, and lpiMouse[2] receives MouseSpeed.
SPI_GETSCREENSAVEACTIVE 0 Points to a BOOL variable that receives TRUE if the screen saver is active, FALSE if it is not.
SPI_GETSCREENSAVETIMEOUT 0 Points to an integer variable that receives the screen-saver timeout value (in milliseconds).
SPI_ICONHORIZONTALSPACING Specifies the icon cell width. NULL
SPI_ICONVERTICALSPACING Specifies the icon cell height. NULL
SPI_LANGDRIVER 0 Points to a string containing the new language driver filename.
SPI_SETBEEP TRUE turns the beeper on; FALSE turns the beeper off. NULL
SPI_SETBORDER Specifies the border multiplier factor. NULL
SPI_SETDESKPATTERN 0 NULL
SPI_SETDESKWALLPAPER 0 Points to a string that specifies the name of the bitmap file.
SPI_SETDOUBLECLKHEIGHT Specifies the double-click height (in pels). NULL
SPI_SETDOUBLECLICKTIME Specifies the double-click time (in milliseconds). NULL
SPI_SETDOUBLECLKWIDTH Specifies the double-click width (in pels). NULL
SPI_SETGRIDGRANULARITY Specifies the grid granularity.  
SPI_SETICONTITLEWRAP TRUE turns wrapping on; FALSE turns wrapping off. NULL
SPI_SETKEYBOARDDELAY Specifies the keyboard-delay setting. NULL
SPI_SETKEYBOARDSPEED Specifies the repeat-speed setting. NULL
SPI_SETMENUDROPALIGNMENT TRUE specifies right alignment, FALSE specifies left alignment. NULL
SPI_SETMOUSE 0 Points to an integer array where lpiMouse[0] receives xMouseThreshold, lpiMouse[1] receives yMouseThreshold, and lpiMouse[2] receives MouseSpeed.
SPI_SETMOUSEBUTTONSWAP TRUE reverses the meaning of the left and right mouse buttons, FALSE restores the buttons to their original meaning. NULL
SPI_SETSCREENSAVEACTIVE TRUE activates screen saving; FALSE deactivates screen saving. NULL
SPI_SETSCREENSAVETIMEOUT Specifies the idle time-out duration (in seconds) before the screen is saved. NULL