Solved

check another app is stoping or running in main app?

Posted on 2006-11-29
4
174 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
Comment Utility
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
Comment Utility
Ops that has to be

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now