Use FindWindow to find the main window handle of the program, and if it exists, send the message WM_CLOSE to the window to close it.
Ross. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Stephen Bowker Sent: Tuesday, 27 January 2009 4:14 a.m. To: Delphi (E-mail) Subject: Check if specific EXE is running and close/open it Hi, I'm trying to write a program that checks if a specific EXE file is running. If it is, then I need to close it, copy over the latest version, and then run it again, Can anyone give me some help with whatever windows API calls I need to use (or if there any existing Delphi functions/procedures I can use) My code would ideally look like the following, so would need the code for the functions I'm calling... if ExeIsRunning('SPECIFIC.EXE') then begin CloseRunningExe('SPECIFIC.EXE'); // do my stuff here - already know what I am doing here! OpenExeAgain('SPECIFIC.EXE'); // Can prob guess that I use ShellExecute here? end else // do my stuff here - already know what I am doing here! PS - I am using Delphi 5 in a Win32 environment Thank in advance for any help Regards, Steve B. _______________________________________________ Delphi mailing list -> [email protected] http://lists.elists.org/cgi-bin/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

