100分求解WIN2000下输入法的问题!

pigherd 2002-03-14 10:05:44
WIN98下用API函数实现,如下(嘿嘿,COPY):
声明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



但在WIN2000下上述办法好象不行,求教!另外其他输入法(如五笔)如何切换?谢谢!
...全文
65 点赞 收藏 7
写回复
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xjbs 2002-06-24
uppppp
回复
PBsystem 2002-06-24
看我的2000下实现,只能用在输入项内


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"
Subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo ) library "user32.dll"

constant int IME_THotKey_IME_NonIME_Toggle = 112
ulong hklcurrent
ulong hnd
//中文
hklcurrent = getkeyboardlayout(0)
if not ImmIsIme(hklcurrent) then
//hnd = handle(parent)
//ImmSimulateHotKey(hnd,IME_THotKey_IME_NonIME_Toggle)
// CTRL + SPACE
keybd_event(17,0,0,0)
keybd_event(32,0,0,0)
keybd_event(17,0,2,0)
keybd_event(32,0,2,0)
end if
//英文 
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)
// CTRL + SPACE
keybd_event(17,0,0,0)
keybd_event(32,0,0,0)
keybd_event(17,0,2,0)
keybd_event(32,0,2,0)
end if
回复
Hanson_bati_zhu 2002-03-15
看看
http://www.impu.edu.cn/learner/aboutoffice/openinputword.htm
或许有帮助
回复
zjchenhui 2002-03-15
gz
回复
pigherd 2002-03-15
gz
回复
QiHY 2002-03-15
ActiveKeyboardLayout
回复
programbcb 2002-03-15
gz,我也遇到这个问题
回复
发动态
发帖子
非技术版
创建于2007-09-28

378

社区成员

PowerBuilder 非技术版
申请成为版主
社区公告
暂无公告