Send char to another application
< Continued from page 4
The following code is used to insert a character into another application - Notepad.
~~~~~~~~~~~~~~~~~~~~~~~~~
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;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» Week number calculating
« Standard Dialogs: changing default button title
The following code is used to insert a character into another application - Notepad.
~~~~~~~~~~~~~~~~~~~~~~~~~
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;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» Week number calculating
« Standard Dialogs: changing default button title
Source...