VC++环境下获取当前输入法名称

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; }

你可能感兴趣的:(WINDOWS编程杂记)