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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if .EXE is running

Status
Not open for further replies.

Brezhnev

Programmer
Sep 25, 2002
53
CA
Hi all!
I need to run couple of .exes one after the other.What I also need -- is to know exactly when one .exe finishes ..to start the next one.To run my programmes I use
createprocess() api...

Thanx
 
The WaitForInputIdle function enables a thread to suspend its execution until a specified process has finished its initialization and is waiting for user input with no input pending. This can be useful for synchronizing a parent process and a newly created child process. When a parent process creates a child process, the CreateProcess function returns without waiting for the child process to finish its initialization. Before trying to communicate with the child process, the parent process can use WaitForInputIdle to determine when the child's initialization has been completed. For example, the parent process should use WaitForInputIdle before trying to find a window associated with the child process.

How come you are not using shellexecute()? Attitude is Everything
 
i think i did't explain myself properly (english is a beach :))) )
anyway ... i am running .exe ... whatever i need to know -- is when it stops ( when .exe is not running anymore) ..Basically ..whatever you see in the task manager under processes -- i would like to see... For example I am running NotePad.exe ... then i am releasing it ... how to know in FoxPro that i stoped running it ?

thank you
 
look at the FAQ184-1998. you can modify the code to get all window titles. if your title is not shown the program is not running.

you said that you are using createprocess to run the programs. if you are then the post about WaitForInputIdle is the api function to use to track if program is not running. Attitude is Everything
 
According to the Microsoft all WinExec calls are translated directly into corresponding CreateProcess calls Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top