Solved

check another app is stoping or running in main app?

Posted on 2006-11-29
4
175 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

932 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

14 Experts available now in Live!

Get 1:1 Help Now