试试下面的代码<br>========================<br>procedure SendKeys(focushld: HWND; sSend: string);<br>var<br>i:integer;<br>ch: byte;<br>begin<br>i := 1;<br>while i <= Length(sSend) do<br>begin<br>ch := byte(sSend);<br>if Windows.IsDBCSLeadByte(ch) then<br>begin<br>Inc(i); <br>SendMessage(focushld, WM_IME_CHAR, MakeWord(byte(sSend), ch), 0);<br>end<br>else<br>SendMessage(focushld, WM_IME_CHAR, word(ch), 0);<br>Inc(i);<br>end;<br>end;<br>//实例--------------------<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>pt: TPOINT;<br>win: HWND;<br>begin<br>sleep(3000);<br>GetCursorPos(pt);<br>win := WindowFromPoint(pt);<br>sendkeys(win,'汉字');<br>end;<br><br>