怎么获取当前键盘输入法

发布网友 发布时间:2022-04-20 05:46

我来回答

2个回答

热心网友 时间:2023-06-29 03:51

你好
当前输入法是系统的,跟键盘没关系的。
看电脑的右下角

热心网友 时间:2023-06-29 03:51

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

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com