在Win32中有消息或通知检测用户更改区域设置吗? [英] Is there a message or notification in Win32 that detects when user changes locale?

查看:166
本文介绍了在Win32中有消息或通知检测用户更改区域设置吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EDIT:



根据社群的意见,问题得以减少和优化。问题的已删除部分将作为单独的问题发布。



问题:



c $ c> WM_SOMETHING 或 NM_SOMETHING 中可以通知我有关用户的信息 Win32 API 改变 locale ?



你看,我可以使用该消息/通知 code> 添加到当前区域设置

有这样的伪代码:

  case WM_SOMETHING://在我的主窗口程序
_wsetlocale(LC_ALL,L);

此外,如果有这样的消息,并且我在上面的伪代码中处理它,它只会调整只有主窗口的 c c> locale ,或也会为子元素设置 locale



我的努力来解决这个问题:



浏览互联网后,我发现的唯一的东西是 WM_INPUTLANGCHANGE WM_SETTINGCHANGE WM_INPUTLANGCHANGEREQUEST ,但我从未使用过不知道他们是否能解决我的问题。



谢谢。



>

解决方案

Windows会发送 WM_SETTINGCHANGE 讯息, wParam 设置为 0 ,并且 lParam 设置为包含值 intl 。这在参数部分下的 WM_SETTINGCHANGE 文档中有描述:


wParam
...



当系统因区域设置更改而发送此消息 ,此参数为零。



lParam
...



系统发送此消息时由于区域设置更改,此参数指向字符串intl。


您的应用程序将需要回复该消息,并在子对话框和控件中进行任何必要的更改。


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.

解决方案

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.

这篇关于在Win32中有消息或通知检测用户更改区域设置吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆