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下上述办法好象不行,求教!另外其他输入法(如五笔)如何切换?谢谢!
...全文
97 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
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,我也遇到这个问题

397

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 非技术版
社区管理员
  • 非技术版社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧