Is there a message or notification in Win32 that d

2019-01-25 20:17发布

问题:

EDIT:

Question is reduced and optimized in response to community's comments. The deleted part of the question will be posted as separate question.

QUESTION:

Is there any WM_SOMETHING or NM_SOMETHING message in Win32 API that can inform me about user changing the locale?

You see, I could use that message/notification to change my program's locale to the current locale.

Something like this pseudo-code:

case WM_SOMETHING: // in my main window procedure
    _wsetlocale( LC_ALL, L"" );

Also, if there is such message, and I process it as in the pseudo-code above, will it adjust only main window's locale or will it also set locale for child dialog boxes and controls?.

MY EFFORTS TO SOLVE THIS:

After browsing through Internet, the only thing I found was WM_INPUTLANGCHANGE, WM_SETTINGCHANGE and WM_INPUTLANGCHANGEREQUEST messages, but I have never used them and do not know if they can solve my problem.

Thank you.

Best regards.

回答1:

Windows sends a WM_SETTINGCHANGE message, with the wParam set to 0, and the lParam set to a character string containing the value intl. This is described in the documentation for WM_SETTINGCHANGE under the Parameters section:

wParam ...

When the system sends this message as a result of a change in locale settings, this parameter is zero.

lParam ...

When the system sends this message as a result of a change in locale settings, this parameter points to the string "intl".

Your application will need to respond to the message and make any necessary changes yourself in child dialogs and controls.