您现在的位置: 中国教育学习网 >> 电脑教育 >> 程序设计 >> PowerBuiler >> 正文

win98下程序中自动控制切换中英文输入法

日期:2005-12-12 13:14:13 点击: 来自:不详 作者:佚名 【字体: 【加入收藏】
问:在数据窗口录入数据时,有的域要输英文、有的域要输中文,每次要手工切换,很麻烦,能不能在程序中自动控制切换中英文输入法?

答:可以用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"
定义变量:
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
可根据需要,触发两段不同的脚本以达到动态切换中英文输入法的目的。

GoogLe AD Sense
PowerBuiler热门 Hot
PowerBuiler推荐 Commend
  • 此栏目下没有推荐教程
More..GoogLe AdSense
版权所有:中国教育学习网 未经授权禁止复制或建立镜像 建议使用:1024*768分辨率,16位以上颜色、 Netscape6.0、IE5.0以上版本浏览器
CopyRight ® 2005-2008 www.cn-education.com online services. all rights reserved. ICP备案:冀ICP备05021141号
联系方式:EMAIL: cn-education@163.com QQ:47167701 教育网站长QQ交流群60041790