SystemParametersInfo
Liste des cours

The SystemParametersInfo function queries or sets systemwide parameters. This function can also update the user profile while setting a parameter.

BOOL SystemParametersInfo(
UINT uiAction, // system parameter to query or set
UINT uiParam, // depends on action to be taken
PVOID pvParam, // depends on action to be taken
UINT fWinIni // user profile update flag
);

Parameters

uiAction : Specifies the systemwide parameter to query or set. This parameter can be one of the following values:

Value Meaning
SPI_GETACCESSTIMEOUT Retrieves information about the time-out period associated with the accessibility features. The uiParam parameter specifies the size of an ACCESSTIMEOUT structure, and pvParam points to the ACCESSTIMEOUT structure that receives the information.
SPI_GETANIMATION Windows 95 only: Retrieves the animation effects associated with user actions. The pvParam parameter is the pointer to an ANIMATIONINFO structure that contains the retrieved metrics.
SPI_GETBEEP Determines whether the warning beeper is on (TRUE) or off (FALSE). The pvParam parameter points to a BOOL variable.
SPI_GETBORDER Retrieves the border multiplier factor that determines the width of a window's sizing border. The pvParam parameter points to an integer variable.
SPI_GETDEFAULTINPUTLANG Windows 95 only: Returns the keyboard layout handle for the system default input language. The uiParam is not used. The pvParam parameter points to the 32-bit variable that receives the keyboard layout handle for the default language.
SPI_GETDRAGFULLWINDOWS Windows 95 only: Determines whether dragging of full windows is enabled. The pvParam parameter points to a BOOL variable that receives TRUE if enabled, or FALSE otherwise.
SPI_GETFASTTASKSWITCH Determines whether fast task switching is enabled. The pvParam parameter points to a BOOL variable that receives TRUE if enabled, or FALSE otherwise.
SPI_GETFILTERKEYS Retrieves information about the FilterKeys accessibility feature. The uiParam parameter specifies the size of the FILTERKEYS structure, and pvParam points to the FILTERKEYS structure that receives the information.
SPI_GETGRIDGRANULARITY Retrieves the current granularity value of the desktop sizing grid. The pvParam parameter points to an integer variable that receives the granularity.
SPI_GETHIGHCONTRAST Windows 95 only: Retrieves information about the HighContrast accessibility feature. The pvParam parameter is the pointer to the HIGHCONTRAST structure that receives the information.
SPI_GETICONMETRICS Windows 95 only: Retrieves the metrics associated with icons. The pvParam parameter points to the ICONMETRICS structure to fill in.
SPI_GETICONTITLELOGFONT Retrieves the logical font information for the current icon-title font. The uiParam parameter specifies the size of a LOGFONT structure, and the pvParam parameter points to the LOGFONT structure to fill in.
SPI_GETICONTITLEWRAP Determines whether icon-title wrapping is enabled. The pvParam parameter points to a BOOL variable that receives TRUE if enabled, or FALSE otherwise.
SPI_GETKEYBOARDDELAY Retrieves the keyboard repeat-delay setting. The pvParam parameter points to an integer variable that receives the setting.
SPI_GETKEYBOARDPREF Windows 95 only: Determines whether the user relies on the keyboard instead of the mouse, and wants applications to display keyboard interfaces that would otherwise be hidden. The uiParam parameter points to a BOOL variable that receives TRUE if the user relies on the keyboard; the variable receives FALSE otherwise.
SPI_GETKEYBOARDSPEED Retrieves the keyboard repeat-speed setting. The pvParam parameter points to a DWORD variable that receives the setting.
SPI_GETLOWPOWERACTIVE Windows 95 only: Determines whether the low-power phase of screen saving is enabled or not. The pvParam parameter points to a BOOL variable that receives TRUE if enabled, or FALSE if disabled.
SPI_GETLOWPOWERTIMEOUT Windows 95 only: Retrieves the time-out value for the low-power phase of screen saving. The pvParam parameter points to an integer value that receives the value.
SPI_GETMENUDROPALIGNMENT Determines whether pop-up menus are left-aligned or right-aligned, relative to the corresponding menu-bar item. The pvParam parameter points to a BOOL variable that receives TRUE if left-aligned, or FALSE otherwise.
SPI_GETMINIMIZEDMETRICS Windows 95 only: Retrieves the metrics associated with minimized windows. The uiParam parameter specifies the size of the MINIMIZEDMETRICS structure. The pvParam parameter points to the MINIMIZEDMETRICS structure to fill in.
SPI_GETMOUSE Retrieves the two mouse threshold values and the mouse speed. The pvParam parameter points to an array of three integers that receives these values. See mouse_event for further information.
SPI_GETMOUSEKEYS Retrieves information about the MouseKeys accessibility feature. The uiParam parameter specifies the size of a MOUSEKEYS structure, and pvParam points to the MOUSEKEYS structure that receives the information.
SPI_GETNONCLIENTMETRICS Windows 95 only: Retrieves the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter points to the NONCLIENTMETRICS structure to fill in.
SPI_GETPOWEROFFACTIVE Windows 95 only: Determines whether the power-off phase of screen saving is enabled or not. The pvParam parameter points to a BOOL variable that receives TRUE if enabled, or FALSE if disabled.
SPI_GETPOWEROFFTIMEOUT Windows 95 only: Retrieves the time-out value for the power-off phase of screen saving. The pvParam parameter points to an integer value that receives the value.
SPI_GETSCREENREADER Windows 95 only: Determines whether a screen reviewer utility is running (TRUE) or not (FALSE). A screen reviewer utility directs textual information to an output device, such as a speech synthesizer or Braille display. When this flag is set, an application should provide textual information in situations where it would otherwise present the information graphically. The pvParam parameter points to a BOOL variable.
SPI_GETSCREENSAVEACTIVE Determines whether screen saving is enabled. The pvParam parameter points to a BOOL variable that receives TRUE if enabled, or FALSE otherwise.
SPI_GETSCREENSAVETIMEOUT Retrieves the screen saver time-out value, in seconds. The pvParam parameter points to an integer variable that receives the value.
SPI_GETSERIALKEYS Windows 95 only: Retrieves information about the SerialKeys accessibility feature. The pvParam parameter points to the SERIALKEYS structure that receives the information.
SPI_GETSHOWSOUNDS Determines whether the user requires an application to present information visually in situations where it would otherwise present the information only in audible form. The uiParam parameter points to a BOOL variable.Using this value is equivalent to calling GetSystemMetrics (SM_GETSHOWSOUNDS). That is the recommended call.
SPI_GETSOUNDSENTRY Retrieves information about the SoundSentry accessibility feature. The uiParam parameter specifies the size of a SOUNDSENTRY structure, and pvParam points to the SOUNDSENTRY structure that receives the information.
SPI_GETSTICKYKEYS Retrieves information about the MouseKeys accessibility feature. The uiParam parameter specifies the size of a STICKYKEYS structure, and pvParam points to the STICKYKEYS structure that receives the information.
SPI_GETTOGGLEKEYS Retrieves information about the ToggleKeys accessibility feature. The uiParam parameter specifies the size of a TOGGLEKEYS structure, and pvParam points to the TOGGLEKEYS structure that receives the information.
SPI_GETWORKAREA Windows 95 only: Retrieves the size of the working area. The working area is the portion of the screen not obscured by the tray. The pvParam parameter points to the RECT structure that receives the coordinates of the working area.
SPI_ICONHORIZONTALSPACING Sets the width of an icon cell. The uiParam parameter specifies the width, in pixels.
SPI_ICONVERTICALSPACING Sets the height of an icon cell. The uiParam parameter specifies the height, in pixels.
SPI_LANGDRIVER Windows 95: Identifies the language driver. The pvParam parameter points to a character array that receives the filename of the language driver.
SPI_SETACCESSTIMEOUT Sets the time-out period associated with the accessibility features. The uiParam parameter specifies the size of the ACCESSTIMEOUT structure, and pvParam points to the ACCESSTIMEOUT structure that contains the new parameters.
SPI_SETANIMATION Windows 95 only: Sets the animation effects associated with user actions. The pvParam parameter points to an ANIMATIONINFO structure that contains the new metrics.
SPI_SETBEEP Turns the warning beeper on or off. The uiParam parameter specifies TRUE for on, or FALSE for off.
SPI_SETBORDER Sets the border multiplier factor that determines the width of a window's sizing border. The uiParam parameter specifies the new value.
SPI_SETDEFAULTINPUTLANG Windows 95 only: Sets the default input language for the system shell and applications. The specified language must be displayable using the current system character set. The uiParam parameter is not used. The pvParam parameter points to a 32-bit variable that contains the keyboard layout handle for the default language.
SPI_SETDESKPATTERN Sets the current desktop pattern by causing Windows to read the Pattern= setting from the WIN.INI file.
SPI_SETDESKWALLPAPER Sets the desktop wallpaper. The pvParam parameter points to a null-terminated string containing the name of a bitmap file.
SPI_SETDOUBLECLICKTIME Sets the double-click time for the mouse to the value of the uiParam parameter. The double-click time is the maximum number of milliseconds that can occur between the first and second clicks of a double-click.
SPI_SETDOUBLECLKHEIGHT Sets the height of the double-click rectangle to the value of the uiParam parameter.The double-click rectangle is the rectangle within which the second click of a double-click must fall for it to be registered as a double-click.
SPI_SETDOUBLECLKWIDTH Sets the width of the double-click rectangle to the value of the uiParam parameter.The double-click rectangle is the rectangle within which the second click of a double-click must fall for it to be registered as a double-click.
SPI_SETDRAGFULLWINDOWS Windows 95 only: Sets dragging of full windows either on or off. The uiParam parameter specifies TRUE for on, or FALSE for off.
SPI_SETDRAGHEIGHT Windows 95 only: Sets the height, in pixels, of the rectangle used to detect the start of a drag operation.
SPI_SETDRAGWIDTH Windows 95 only: Sets the width, in pixels, of the rectangle used to detect the start of a drag operation.
SPI_SETFASTTASKSWITCH Turns fast task switching on or off. The uiParam parameter specifies TRUE for on, or FALSE for off.
SPI_SETFILTERKEYS Sets the parameters of the FilterKeys accessibility feature. The uiParam parameter specifies the size of the FILTERKEYS structure, and pvParam points to the FILTERKEYS structure that contains the new parameters.
SPI_SETGRIDGRANULARITY Sets the granularity of the desktop sizing grid to the value of the uiParam parameter.
SPI_SETHIGHCONTRAST Windows 95 only: Sets the parameters of the HighContrast accessibility feature. The pvParam parameter is the address of the HIGHCONTRAST structure that contains the new parameters.
SPI_SETICONMETRICS Windows 95 only: Sets the metrics associated with icons. The pvParam parameter points to an ICONMETRICS structure that contains the new metrics.
SPI_SETICONTITLELOGFONT Sets the font that is used for icon titles. The uiParam parameter specifies the size of a LOGFONT structure, and the lParam parameter points to a LOGFONT structure.
SPI_SETICONTITLEWRAP Turns icon-title wrapping on or off. The uiParam parameter specifies TRUE for on, or FALSE for off.
SPI_SETKEYBOARDDELAY Sets the keyboard repeat-delay setting to the value of the uiParam parameter.
SPI_SETKEYBOARDPREF Windows 95 only: Sets the keyboard preference. The uiParam parameter specifies TRUE if the user relies on the keyboard instead of the mouse, and wants applications to display keyboard interfaces that would otherwise be hidden; uiParam is FALSE otherwise.
SPI_SETKEYBOARDSPEED Sets the keyboard repeat-speed setting to the value of the uiParam parameter.
SPI_SETLANGTOGGLE Windows 95 only: Sets the hot key set for switching between input languages. The uiParam and pvParam parameters are not used. The value sets the shortcut keys in the keyboard property sheets by reading the registry again. The registry must be set before this flag is used. the path in the registry is \HKEY_CURRENT_USER\keyboard layout\toggle. Valid values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT, and "3" = none.
SPI_SETLOWPOWERACTIVE Windows 95 only: Activates or deactivates the low-power phase of screen saving. Set uiParam to 1 to activate, or 0 to deactivate. The pvParam parameter must be NULL.
SPI_SETLOWPOWERTIMEOUT Windows 95 only: Retrieves the time-out value, in seconds, for the low-power phase of screen saving. The uiParam parameter specifies the new value. The pvParam parameter must be NULL.
SPI_SETMENUDROPALIGNMENT Sets the alignment value of pop-up menus. The uiParam parameter specifies TRUE for right alignment, or FALSE for left alignment.
SPI_SETMINIMIZEDMETRICS Windows 95 only: Sets the metrics associated with minimized windows. The pvParam parameter points to a MINIMIZEDMETRICS structure that contains the new metrics.
SPI_SETMOUSE Sets the two mouse threshold values and the mouse speed. The pvParam parameter points to an array of three integers that specifies these values. See mouse_event for further information.
SPI_SETMOUSEBUTTONSWAP Swaps or restores the meaning of the left and right mouse buttons. The uiParam parameter specifies TRUE to swap the meanings of the buttons, or FALSE to to restore their original meanings.
SPI_SETMOUSEKEYS Sets the parameters of the MouseKeys accessibility feature. The uiParam parameter specifies the size of the MOUSEKEYS structure, and pvParam points to the MOUSEKEYS structure that contains the new parameters.
SPI_SETNONCLIENTMETRICS Windows 95 only: Sets the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter is the address of a NONCLIENTMETRICS structure that contains the new metrics.
SPI_SETPENWINDOWS Windows 95 only: Specifies that pen windows is being loaded or unloaded. The uiParam parameter is TRUE when loading and FALSE when unloading pen windows. The lParam parameter is NULL.
SPI_SETPOWEROFFACTIVE Windows 95 only: Activates or deactivates the power-off phase of screen saving. Set uiParam to 1 to activate, or 0 to deactivate. The pvParam parameter must be NULL.
SPI_SETPOWEROFFTIMEOUT Windows 95 only: Retrieves the time-out value, in seconds, for the power-off phase of screen saving. The uiParam parameter specifies the new value. The pvParam parameter must be NULL.
SPI_SETSCREENREADER Windows 95 only: Indicates whether a screen review utility is running. The uiParam parameter specifies TRUE for on, or FALSE for off.
SPI_SETSCREENSAVEACTIVE Sets the state of the screen saver. The uiParam parameter specifies TRUE to activate screen saving, or FALSE to deactivate it.
SPI_SETSCREENSAVETIMEOUT Sets the screen saver time-out value to the value of the uiParam parameter. This value is the amount of time, in seconds, that the system must be idle before the screen saver activates.
SPI_SETSERIALKEYS Windows 95 only: Sets the parameters of the SerialKeys accessibility feature. The pvParam parameter is the address of the SERIALKEYS structure that contains the new parameters.
SPI_SETSHOWSOUNDS Sets the ShowSounds accessibility feature as on or off. The uiParam parameter specifies TRUE for on, or FALSE for off.
SPI_SETSOUNDSENTRY Sets the parameters of the SoundSentry accessibility feature. The uiParam parameter specifies the size of the SOUNDSENTRY structure, and pvParam points to the SOUNDSENTRY structure that contains the new parameters.
SPI_SETSTICKYKEYS Sets the parameters of the StickyKeys accessibility feature. The uiParam parameter specifies the size of the STICKYKEYS structure, and pvParam points to the STICKYKEYS structure that contains the new parameters.
SPI_SETTOGGLEKEYS Sets the parameters of the ToggleKeys accessibility feature. The uiParam parameter specifies the size of the TOGGLEKEYS structure, and pvParam points to the TOGGLEKEYS structure that contains the new parameters.
SPI_SETWORKAREA Windows 95 only: Sets the size of the working area. The working area is the portion of the screen not obscured by the tray. The pvParam parameter points to the RECT structure that contains the coordinates of the working area.

uiParam : Depends on the system parameter being queried or set. For more information about systemwide parameters, see the uiAction parameter. If not otherwise indicated, specify zero.

pvParam : Depends on the system parameter being queried or set. For more information about systemwide parameters, see the uiAction parameter. If not otherwise indicated, specify zero.

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

Value Action
SPIF_UPDATEINIFILE Writes the new system-wide parameter setting to the user profile.
SPIF_SENDWININICHANGE Broadcasts the WM_WININICHANGE message after updating the user profile.

Return Value

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.

Remarks

This function is intended for use with applications, such as Control Panel, that allow the user to customize the Windows environment.
A keyboard layout name should be derived from the hexadecimal value of the language identifier corresponding to the layout. For example, U.S. English has a language identifier of 0x0409, so the primary U.S. English layout is named "00000409." Variants of U.S. English layout, such as the Dvorak layout, are named "00010409," "00020409" and so on. For a list of the primary language identifiers and sublanguage identifiers that make up a language identifier, see the MAKELANGID macro.