We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


The framework calls OnSettingChange for all top-level windows when the Win32 SystemParametersInfo function changes a system-wide setting.

afx_msg void OnSettingChange( 
   UINT uFlags, 
   LPCTSTR lpszSection  


When the system sends the message as a result of a SystemParametersInfo call, this parameter is a flag that indicates the system parameter that was changed. For a list of values, see SystemParametersInfo in the Windows SDK. When an application sends the message, this parameter must be 0.


Points to a string that specifies the name of the section that has changed. (The string does not include the square brackets that enclose the section name.)

An application should send the message to all top-level windows when it makes changes to system parameters, and Windows will send the message if the user changes settings via the Control Panel.

The ON_WM_SETTINGCHANGE message is similar to the ON_WM_WININICHANGE message, with the following difference:

  • Use ON_WM_SETTINGCHANGE when running Windows NT 4.0 or newer, or under Windows 95/98.

  • Use ON_WININICHANGE when running Windows NT 3.51 or older. This message is now obsolete.

You should have only one of these macros in your message map. To write a program that works for both Windows 95/98 and Windows NT 4.0, write a handler for ON_WM_SETTINGCHANGE. Under Windows NT 3.51, your handler will be called by OnSettingChange and uFlags and will always be zero.

Header: afxwin.h