以下程序向 记事本 发送字符procedure TForm1.Button1Click(Sender: TObject); var g,d:integer; begin {Find the main window of the Application} g:=FindWindow('Notepad',nil) ; //向记事本发送字符 {Find the window of the application's text box} d:=ChildWindowFromPoint(g,point(50,50)) ; {Now send it a character!!} SendMessage(d,WM_CHAR,Ord('A'),0) ; end;
var g,d:integer;
begin
{Find the main window of the Application}
g:=FindWindow('Notepad',nil) ; //向记事本发送字符
{Find the window of the application's text box}
d:=ChildWindowFromPoint(g,point(50,50)) ;
{Now send it a character!!}
SendMessage(d,WM_CHAR,Ord('A'),0) ;
end;