SystemParametersInfo

This function queries or sets system-wide parameters, and updates the user profile during the process.

At a Glance

Header file: Winuser.h
Windows CE versions: 2.0 and later

Syntax

BOOL SystemParametersInfo ( UINT uiAction, UINT uiParam,
PVOID
pvParam, UINT fWinIni);

Parameters

uiAction

[in] Specifies the system-wide parameter to query or set. This parameter can be one of the following values:

Value Description
SPI_GETBATTERYIDLETIMEOUT Gets the amount of time that Windows CE will stay on with battery power before it suspends due to user inaction. The pvParam parameter points to a DWORD that returns the time in seconds. This flag is ignored if pvParam is zero.
SPI_GETEXTERNALIDLETIMEOUT Gets the amount of time that Windows CE will stay on with AC power before it suspends due to user inaction. The pvParam parameter points to a DWORD that returns the time in seconds. This flag is ignored if pvParam is zero.
SPI_GETMOUSE Retrieves the two mouse threshold values and the mouse speed.
SPI_GETOEMINFO Returns a string containing the model number and manufacturer name. The uiParam parameter specifies the length of the buffer in pvParam, which on successful return contains the string in Unicode characters.
SPI_GETPLATFORMTYPE Returns a string specifying the type of Windows CE device, such as “H/PC.” The uiParam parameter specifies the length of the buffer in pvParam, which on successful return contains the string in Unicode characters. This string allows applications like H/PC Explorer to determine the device type.
SPI_GETWAKEUPIDLETIMEOUT Gets the amount of time that Windows CE will stay on after a user notification that reactivates a suspended device. The pvParam parameter points to a DWORD that returns the time in seconds. This flag is ignored if pvParam is zero.
SPI_GETWORKAREA Retrieves the size of the work area; the portion of the screen not obscured by the tray.
SPI_SETBATTERYIDLETIMEOUT Sets the amount of time that Windows CE will stay on with battery power before it suspends due to user inaction. The Windows CE operating system will remain on, with battery power, as long as the keyboard or touch screen is active. The uiParam parameter specifies the time to set in seconds. This flag is ignored if uiParam is set to zero.
SPI_SETEXTERNALIDLETIMEOUT  
  Sets the amount of time that Windows CE will stay on with AC power before it suspends due to user inaction. The Windows CE operating system will remain on, with AC power, as long as the keyboard or touch screen is active. The uiParam parameter specifies the time in seconds. This flag is ignored if uiParam is set to zero.
SPI_SETMOUSE Sets the two mouse threshold values and the mouse speed.
SPI_SETWAKEUPIDLETIMEOUT Sets the amount of time that Windows CE will stay on after a user notification that reactivates the suspended device. The uiParam parameter specifies the time in seconds. This flag is ignored if uiParam is set to zero.
SPI_SETWORKAREA Sets the size of the work area—the portion of the screen not obscured by the taskbar.

uiParam

[in] Depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify zero for this parameter.

pvParam

[out] Depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify NULL for this parameter.

If the pvParam buffer is used to get the platform type or OEM information string and the buffer is too small, this function fails with ERROR_INSUFFICIENT_BUFFER in the last error.

fWinIni

[in] Boolean that, if a system parameter is being set, specifies whether the user profile is to be updated, and if so, whether the WM_SETTINGCHANGE 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 Description
SPIF_UPDATEINIFILE Writes the new system-wide parameter setting to the user profile.
SPIF_SENDCHANGE Broadcasts the WM_SETTINGCHANGE message after updating the user profile.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

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

Windows CE supports only the Unicode version of this function.

See Also

GetSystemMetrics