Thursday, January 20, 2011

Closing another application

To close e.g. Notepad, you simply send the message WM_CLOSE to the application's main window:

procedure TForm1.Button1Click(Sender: TObject);
var Hnd: THandle;
begin
Hnd := FindWindow (PChar ('Notepad'), nil);
if Hnd > 0 then
SendMessage (Hnd, WM_CLOSE, 0, 0);
end;

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum