Board index » cppbuilder » Launch exe files

Launch exe files


2004-11-28 08:10:52 PM
cppbuilder108
Hi,
I need to laucn exe file but not at the same time.
For example :
ShellExecute(0,"open","winword.exe",NULL,NULL,SW_SHOWNORMAL);
ShellExecute(0,"open","excel.exe",NULL,NULL,SW_SHOWNORMAL);
Word and excel run at the same time.
I want run excel only if word is closed.
I test a batch file with the command lines :
start /wait winword.exe
start /wait excel.exe
but it doesn't work : word and excel run at the same time.
HELP ME !!!!!!!!
 
 

Re:Launch exe files

Use CreateProcess instead of ShellExecute to launch the program. Unlike ShellExecute, CreateProcess gives you
the process handle of the program that was started.
Use the process handle in a call to
WaitForSingleObject to wait for the first executable to
end before starting the second one.
You might want to post your questions about the native api
in the native api group instead of here where questions
about compatibility with Microsoft products is the expected
subject.
borland.public.cppbuilder.nativeapi
. Ed
Quote
RS wrote:
Hi,

I need to laucn exe file but not at the same time.

For example :

ShellExecute(0,"open","winword.exe",NULL,NULL,
SW_SHOWNORMAL);
ShellExecute(0,"open","excel.exe",NULL,NULL,
SW_SHOWNORMAL);

Word and excel run at the same time.

I want run excel only if word is closed.

I test a batch file with the command lines :

start /wait winword.exe
start /wait excel.exe

but it doesn't work : word and excel run at the same
time.

HELP ME !!!!!!!!