• <legend id='uUHsm'><style id='uUHsm'><dir id='uUHsm'><q id='uUHsm'></q></dir></style></legend>

      <bdo id='uUHsm'></bdo><ul id='uUHsm'></ul>

    1. <small id='uUHsm'></small><noframes id='uUHsm'>

      <tfoot id='uUHsm'></tfoot>

      1. <i id='uUHsm'><tr id='uUHsm'><dt id='uUHsm'><q id='uUHsm'><span id='uUHsm'><b id='uUHsm'><form id='uUHsm'><ins id='uUHsm'></ins><ul id='uUHsm'></ul><sub id='uUHsm'></sub></form><legend id='uUHsm'></legend><bdo id='uUHsm'><pre id='uUHsm'><center id='uUHsm'></center></pre></bdo></b><th id='uUHsm'></th></span></q></dt></tr></i><div id='uUHsm'><tfoot id='uUHsm'></tfoot><dl id='uUHsm'><fieldset id='uUHsm'></fieldset></dl></div>

        找出何时更改键盘布局

        时间:2023-07-26
            <tbody id='l9DVa'></tbody>

              • <bdo id='l9DVa'></bdo><ul id='l9DVa'></ul>
                <legend id='l9DVa'><style id='l9DVa'><dir id='l9DVa'><q id='l9DVa'></q></dir></style></legend>
              • <tfoot id='l9DVa'></tfoot>
                <i id='l9DVa'><tr id='l9DVa'><dt id='l9DVa'><q id='l9DVa'><span id='l9DVa'><b id='l9DVa'><form id='l9DVa'><ins id='l9DVa'></ins><ul id='l9DVa'></ul><sub id='l9DVa'></sub></form><legend id='l9DVa'></legend><bdo id='l9DVa'><pre id='l9DVa'><center id='l9DVa'></center></pre></bdo></b><th id='l9DVa'></th></span></q></dt></tr></i><div id='l9DVa'><tfoot id='l9DVa'></tfoot><dl id='l9DVa'><fieldset id='l9DVa'></fieldset></dl></div>

                  <small id='l9DVa'></small><noframes id='l9DVa'>

                  本文介绍了找出何时更改键盘布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一个屏幕键盘,并希望在键盘布局更改后立即重新绘制我的布局.

                  I am writing an onscreen keyboard and would like to redraw my layout as soon as keyboard layout is changed.

                  目前我打电话:

                  GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow(), NULL));
                  

                  在每次按键时查看布局是否已更改.如果用户通过鼠标更改布局,则它不起作用,直到按下键.

                  on every key press to find out if the layout has changed. It does not work if user changes the layout by mouse, until key is pressed.

                  我想知道是否有任何方法可以得到通知当当前前台窗口的键盘布局改变时,这样我就可以在更改发生后立即重新绘制布局.

                  I would like to know if there is any way to get notified when the keyboard layout of the current foreground window is changed, so I can redraw my layout as soon as the change happens.

                  推荐答案

                  有办法...

                  首先您需要注册您的应用程序以捕获前台窗口更改:
                  使用 SetWinEventHookEVENT_SYSTEM_FOREGROUND (和 WINEVENT_OUTOFCONTEXT,因为它是 .NET).

                  First you need to register your application to capture foreground window changes:
                  Use SetWinEventHook with EVENT_SYSTEM_FOREGROUND (and WINEVENT_OUTOFCONTEXT as it's .NET) for that.

                  如果发生这种情况:使用您的 GetKeyboardLayout 解决方案获取该窗口的当前布局.

                  If that happens: Use your GetKeyboardLayout solution for getting the current layout of that window.

                  然后使用本地 Windows Hook (您可能在低级别全局使用它来捕获密钥)WH_CALLWNDPROC 和新前台窗口的线程.
                  收听 WM_INPUTLANGCHANGE 消息接收布局更改的窗口.
                  (您可能希望在另一个前台更改后取消挂钩/重新挂钩)

                  Then use a local Windows Hook (you're probably using it low-level-globally for key captures) with WH_CALLWNDPROC and the thread of the new foreground window.
                  Listen to WM_INPUTLANGCHANGE messages to that window to receive changes to the layout.
                  (You may want to unhook/rehook after another foreground change)

                  这篇关于找出何时更改键盘布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:SetWindowsHookEx 全局键盘挂钩未捕获所有按键 下一篇:在我的应用程序在后台时监视 C# 中的键盘活动

                  相关文章

                  <small id='t0ffx'></small><noframes id='t0ffx'>

                  1. <tfoot id='t0ffx'></tfoot><legend id='t0ffx'><style id='t0ffx'><dir id='t0ffx'><q id='t0ffx'></q></dir></style></legend>
                      <bdo id='t0ffx'></bdo><ul id='t0ffx'></ul>
                      <i id='t0ffx'><tr id='t0ffx'><dt id='t0ffx'><q id='t0ffx'><span id='t0ffx'><b id='t0ffx'><form id='t0ffx'><ins id='t0ffx'></ins><ul id='t0ffx'></ul><sub id='t0ffx'></sub></form><legend id='t0ffx'></legend><bdo id='t0ffx'><pre id='t0ffx'><center id='t0ffx'></center></pre></bdo></b><th id='t0ffx'></th></span></q></dt></tr></i><div id='t0ffx'><tfoot id='t0ffx'></tfoot><dl id='t0ffx'><fieldset id='t0ffx'></fieldset></dl></div>