VC++环境下获取当前输入法名称
buffer=new char[255];
::memset(buffer,0,255);
thId=::GetWindowThreadProcessId(gFocus,NULL);
//currentThId=::GetCurrentThreadId();
//::AttachThreadInput(currentThId,thId,TRUE);
hkl=::GetKeyboardLayout(thId);
::ImmGetDescription(hkl,buffer,255);
::ImmGetDescription(hkl,buffer,255);
//::MessageBox(NULL,buffer,"aaa",MB_OK); }
打开程序窗口后禁止使用输入法~~~
如下:
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
#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
转载于:https://blog.51cto.com/laokaddk/325942