打印本文 打印本文 关闭窗口 关闭窗口
如何在PB中切换中英文输入法数
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1105  更新时间:2009/4/24 21:42:44  文章录入:mintao  责任编辑:mintao

函数声明:
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 hklCurrent
ulong 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

打印本文 打印本文 关闭窗口 关闭窗口