Friday, January 21, 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;
  Hnd := FindWindow (PChar ('Notepad'), nil);
  if Hnd > 0 then
    SendMessage (Hnd, WM_CLOSE, 0, 0);

Twitter Delicious Facebook Digg Stumbleupon Favorites More

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