Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing files

Status
Not open for further replies.

tweetie777

Programmer
Nov 22, 2001
14
0
0
ZA
I know how to run an exe file using the SHELLEXECUTE command. How do you close that same file? Thanks to anyone who can help. Please provide a sample of code.
 
Have a look at

TerminateProcess

type this and click F1 with the cursor over it, there is information on usage in the help file.


Steve
Be excellent to each other and Party on!
 
You will probobly need to use something like 'getforgroundwindow' to get the handle of the application you want to terminate.

Steve
Be excellent to each other and Party on!
 
Try this

Code:
procedure TForm1.Button1Click(Sender: TObject);
var fnhandle : thandle;
begin
 FNHandle := FindWindow(nil,'FormCaptionText');
 SendMessage(FNHandle,WM_Close,0,0);
end;

where in FormCaptionText you substitute the caption of the form of the application you want to close;

Giovanni Caramia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top