procedure TForm1.Button1Click(Sender: TObject);
var
hwd: HWND;
txt: pchar;
i:integer;
begin
hwd := FindWindowEx(FindWindow('NotePad',nil),0,'Edit',nil);
if hwd = 0 then
begin
showMessage('记事本没打开');
exit;
end;
txt := '11这是一行中文';
for i:=1 to length(txt) do
postMessage(hwd, WM_char,ord(txt),1);
end;