怎么获取当前键盘输入法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么获取当前键盘输入法相关的知识,希望对你有一定的参考价值。

参考技术A 你好
当前输入法是系统的,跟键盘没关系的。
看电脑的右下角
参考技术B VC++环境下获取当前输入法名称
from: http://blog.csdn.net/lclai/archive/2009/06/02/4235239.aspx

CString GetCurrentIme()

//LPDWORD pId;
DWORD thId;
//DWORD currentThId;
HKL hkl;
LPSTR buffer;
buffer=new char[255];
::memset(buffer,0,255);
thId=::GetWindowThreadProcessId(gFocus,NULL);
//currentThId=::GetCurrentThreadId();
//::AttachThreadInput(currentThId,thId,TRUE);
hkl=::GetKeyboardLayout(thId);
if (::ImmIsIME(hkl))

::ImmGetDescription(hkl,buffer,255);

else

::ImmGetDescription(hkl,buffer,255);

//::MessageBox(NULL,buffer,"aaa",MB_OK);
return buffer;


打开程序窗口后禁止使用输入法~~~
如下:

C/C++ codeHIMC hIMC;
hIMC = ImmAssociateContext(hWnd, NULL);
// It makes IME disable for hWnd window.
// Then you can do whatever you want without IME.

ImmAssociateContext(hWnd, hIMC);
// If you want to enable IME again,
// then you can use the previous stored IME
// context(hIMC) to restore IME.

使用时:

C/C++ code
#include <imm.h>
#pragma comment ( lib , "imm32.lib" )

打开程序窗口后禁止使用输入法~~~
如下:

C/C++ codeHIMC hIMC;
hIMC = ImmAssociateContext(hWnd, NULL);
// It makes IME disable for hWnd window.
// Then you can do whatever you want without IME.

ImmAssociateContext(hWnd, hIMC);
// If you want to enable IME again,
// then you can use the previous

QTreeview在键盘选中节点时怎么获得信号并取得当前节点的内容

参考技术A void QItemSelectionModel::currentChanged(const QModelIndex & current, const QModelIndex & previous) [signal]
This signal is emitted whenever the current item changes. The previous model item index is replaced by the current index as the selection's current item.
Note that this signal will not be emitted when the item model is reset.

信号糟使用QTreeView->selectionModel(),而不是QTreeView本回答被提问者采纳

以上是关于怎么获取当前键盘输入法的主要内容,如果未能解决你的问题,请参考以下文章

java从键盘接受字符串行BufferedReader(InputStreamReader(System.in))这样用BufferedReader对象读取行

Android中怎么实现模拟键盘输入?

openGL获取键盘输入的问题

怎么随时呼出手机键盘

怎么使C语言程序在后台运行并接收键盘输入?

h5输入框加载手机键盘超时卡死