1.
调用 GetKeyboardLayout 获取输入法的 HKL后, 在注册表中查找输入法名称(以记事本为例)
hWnd = WinGetHandle("classname=Notepad")
KeyStr=GetKeyboardLayout($hWnd)
KeyName=RegRead("HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Keyboard Layouts/" & $KeyStr, "Layout Text")
2.调用 GetKeyboardLayout 和 ImmGetDescription 这两个函数
3.ImmGetConversionStatus(ImmGetContext(GetForegroundWindow),a,b)
4.TID := GetWindowThreadProcessID(GetForegroundWindow,@PID);
MyHkl := GetKeyBoardLayout(TID);
5.
//获取输入法列表 begin Memo1.Lines := Screen.Imes; end;
//获取当前输入法 var kl: HKL; i: Integer; begin kl := GetKeyboardLayout(0); for i := 0 to Screen.Imes.Count - 1 do if HKL(Screen.Imes.Objects[i]) = kl then ShowMessage(Screen.Imes.Strings[i]); {显示当前输入法} end;