如何在delphi 中模拟按键输入中文! ( 积分: 20 )

  • 主题发起人 主题发起人 ak_2004
  • 开始时间 开始时间
A

ak_2004

Unregistered / Unconfirmed
GUEST, unregistred user!
现在要做一个模拟键盘按键输入的程序,用postmessage(hwnd,wm_char,longint('A')),0)<br>只能模拟按一个字符,怎么样才能模拟按下中文呀?<br>请高手指点!
 
现在要做一个模拟键盘按键输入的程序,用postmessage(hwnd,wm_char,longint('A')),0)<br>只能模拟按一个字符,怎么样才能模拟按下中文呀?<br>请高手指点!
 
怎么没人啊
 
代码:
<br>procedure SendKeys(H: THandle; sSend: string);<br>var<br> &nbsp;i: integer;<br> &nbsp;ch: byte;<br>begin<br> &nbsp;SetFocus(H);<br> &nbsp;if H = 0 then Exit;<br> &nbsp;i := 1;<br> &nbsp;while i &lt;= Length(sSend) do begin<br> &nbsp; &nbsp;ch := byte(sSend[i]); //send string<br> &nbsp; &nbsp;if Windows.IsDBCSLeadByte(ch) then begin<br> &nbsp; &nbsp; &nbsp;Inc(i);<br> &nbsp; &nbsp; &nbsp;SendMessage(H, WM_IME_CHAR, MakeWord(byte(sSend[i]), ch), 0);<br> &nbsp; &nbsp;end<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp;SendMessage(H, WM_IME_CHAR, word(ch), 0);<br> &nbsp; &nbsp;Inc(i);<br> &nbsp;end;<br>end;<br>
 
谢谢!!
 
接受答案了.
 

Similar threads

D
回复
0
查看
841
DelphiTeacher的专栏
D
D
回复
0
查看
847
DelphiTeacher的专栏
D
D
回复
0
查看
681
DelphiTeacher的专栏
D
后退
顶部