如何动态设置某个未获得焦点的窗口的输入法?(100分)

  • 主题发起人 主题发起人 happydelphi
  • 开始时间 开始时间
H

happydelphi

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在我的程序中激活不是当前窗口的某个窗口(如写字板)的输入法,请问如何实现?<br>或者即使该窗口获得了焦点,可是我要在自己的程序中暗中改变该窗口的输入法状态,<br>请问如何实现?<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 分不够可再加
 
调用:<br>&nbsp; ToChinese(Edit1.Handle, True);<br><br>procedure ToChinese(Handle: THandle; bChinese: Boolean = True);<br>var<br>&nbsp; bActivated: Boolean;<br>&nbsp; iLastIme: Integer;<br>begin<br>&nbsp; bActivated := False;<br>&nbsp; if bChinese then<br>&nbsp; begin<br>&nbsp; &nbsp; iLastIme := Screen.Imes.IndexOf('你的写字板输入法名');<br>&nbsp; &nbsp; if iLastIme &gt;= 0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; ActivateKeyboardLayout(HKL(Screen.Imes.Objects[iLastIme]), 0);<br>&nbsp; &nbsp; &nbsp; ImeModeSymbolAndNoFullShape(Handle);<br>&nbsp; &nbsp; &nbsp; bActivated := True;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; bFirstUseIme := False;<br>&nbsp; end;<br>&nbsp; if not bActivated and<br>&nbsp; &nbsp; (ImmIsIME(GetKeyboardLayOut(0)) &lt;&gt; bChinese) then<br>&nbsp; &nbsp; &nbsp; ImmSimulateHotKey(Handle, IME_CHotKey_IME_NonIME_Toggle);<br>&nbsp; Application.ProcessMessages; //Make sure the job is done<br>end;<br><br><br>-----<br>http://www.8421.org
 
to qdyoung:<br>&nbsp; &nbsp; 我对你程序中个地方不太明白:<br>&nbsp; ImeModeSymbolAndNoFullShape(Handle);<br>编译无法通过,请问这是什么函数阿?
 
去掉这一行,再说
 
我试过了,在win2000下面测试的,无法改变自己以外窗口的输入法,我是用getforegroundwindow<br>来获得输入参数(窗口)的。
 
后退
顶部