如何在datawindows中切换中英文输入法数?可不可以详细点啊,我是个新手
如何在datawindows中切换中英文输入法数?可不可以详细点啊,我是个新手
用Windows的API函数可以办到。
①定义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"
②脚本:
ulong hklCurrent
ulong hnd
//切换到英文输入法
hklCurrent=GetKeyboardLayout(0)
if ImmIsIME(hklCurrent) then
hnd=Handle(parent)
ImmSimulateHotKey(hnd,112)
end if
//切换到中文输入法
hklCurrent=GetKeyboardLayout(0)
if not ImmIsIME(hklCurrent) then
hnd=Handle(parent)
ImmSimulateHotKey(hnd,112)
end if
另外:GetKeyboardLayout()函数
说明: 取得一个句柄,描述指定应用程序的键盘布局。
返回值: ulong,键盘布局的句柄。
参数 类型及说明
dwLayout ulong,欲检查的线程的标识符。
(转之于 小木鱼)