SetLocaleInfo works without notification

by Michael S. Kaplan, published on 2006/05/21 15:41 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/05/21/603374.aspx


For pretty much its entire natural life, Regional and Language Options has passed a WM_SETTINGCHANGE message with an LPARAM value pointing to the string "intl" -- though in earlier versions, it passed WM_WININICHANGE, but astute header file readers who look at winuser.h will note the following definitions:

#define WM_WININICHANGE                 0x001A
#if(WINVER >= 0x0400)
#define WM_SETTINGCHANGE                WM_WININICHANGE
#endif /* WINVER >= 0x0400 */

People will very naturally ask questions at this point when settings are changed, such as they are when SetLocaleInfo (which still stinks!) is called:

Time displayed in the Task bar is not updated when LOCALE_STIMEFORMAT is updated via SetLocaleInfo.

Even though we're trying to discourage people from calling SetLocaleInfo, it still is a public API, and a user could change the time format in this manner. Not having the time updated seems like something we should fix.

Ah, but if you read the documentation for the WM_SETTINGCHANGE message is explains who is not doing the right thing here:

Applications should send WM_SETTINGCHANGE to all top-level windows when they make changes to system parameters. (This message cannot be sent directly to a window.) To send the WM_SETTINGCHANGE message to all top-level windows, use the SendMessageTimeout function with the hwnd parameter set to HWND_BROADCAST.

So, it is the job of the application that is calling the stinky SetLocaleInfo to let the other applications know that an "intl" change has been made....

 

This post brought to you by "(U+0fc8, a.k.a. TIBETAN SYMBOL PHUR PA)


no comments

referenced by

2006/06/25 About the Fonts folder in Windows, Part 1 (aka What are we talking about?)

2006/05/30 Unattend for Regional and Language Options in Vista

go to newer or older post, or back to index or month or day