- procedure SendKeys(focushld: hwnd; sSend: string);
- var
- i: integer;
- ch: byte;
- begin
- if focushld = 0 then Exit;
- i := 1;
- while i <= Length(sSend) do
- begin
- ch := byte(sSend[i]);
- if Windows.IsDBCSLeadByte(ch) then
- begin
- Inc(i);
- SendMessage(focushld, WM_IME_CHAR, MakeWord(byte(sSend[i]), ch), 0);
- end
- else
- SendMessage(focushld, WM_IME_CHAR, word(ch), 0);
- Inc(i);
- end;
- postmessage(focushld, WM_keydown, 13, 0); //按回车键
- end;