Solved

check another app is stoping or running in main app?

Posted on 2006-11-29
4
176 Views
Last Modified: 2010-04-01
Hi expert, i have question, can help you?

My main app call another app (app2) with parameters to do a thing.

Calling by ShellExcute,
Example:
....
ShellExcute(NULL, _T("Open"), app2 ,param list, NULL, SW_SHOW)
//check whether app2 stop or not
//if stop will do next steps else wait for complete....
.....
Now, i would like to know (by coding) when app2 will end, so that  i can go to next step for the main app

Can anyone show me code how to do. I need this as soon as posible

Thank you
0
Comment
Question by:CongUan
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 150 total points
ID: 18043164
Use ShellExecuteEx

SHELLEXECUTEINFO sei;
ZeroMemory(&sei,sizeof(sei));
sei.cbSize = sizeof(sei);
sei.lpFile = app;
sei.lpVerb = _T("Open");
sei.lpParameters = param_list;
sei.nShow = SW_SHOW
sei.fMask  = SEE_MASK_NOCLOSEPROCESS;
ShellExecuteEx(&sei);

WaitForSingleObject(sei.hProcess);  // wait for process to terminate/close
0
 
LVL 22

Expert Comment

by:ambience
ID: 18043167
Ops that has to be

WaitForSingleObject(sei.hProcess, INFINITE);  // wait for process to terminate/close
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question