您的位置:首页 > 其它

如何在程序中自动控制切换中英文输入法?

2008-05-01 02:48 603 查看
声明API函数:function boolean ImmSimulateHotKey (ULong hWnd, ULong dwHotKeyID) library "IMM32.dll" function ulong GetKeyboardLayout(ulong dwLayout) LIBRARY "user32.dll" function boolean ImmIsIME(uLong hklKeyboardLayout) library "IMM32.DLL" 定义变量:constant int IME_THotKey_IME_NonIME_Toggle=112 ulong hklCurrentulong hnd 切换到英文输入法:hklCurrent=GetKeyboardLayout(0) if ImmIsIME(hklCurrent) then hnd=Handle(parent) ImmSimulateHotKey(hnd,IME_THotKey_IME_NonIME_Toggle) end if 切换到中文输入法:hklCurrent=GetKeyboardLayout(0) if not ImmIsIME(hklCurrent) then hnd=Handle(parent) ImmSimulateHotKey(hnd,IME_THotKey_IME_NonIME_Toggle)end if 可根据需要,触发两段不同的脚本以达到动态切换中英文输入法的目的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: