?
Solved

check another app is stoping or running in main app?

Posted on 2006-11-29
4
Medium Priority
?
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 600 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

741 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