afkmarc afkmarc - 10 months ago 39
C++ Question

Callback for running an external application in C++

I'm working on a Kinect v2 application that at some point execute an external Unity mini game that works with Kinect v2 as well. I'm using

function but I'm not sure how to implement a callback that notify the main application once the Unity application has been closed. I need it because I want to pause the Kinect manager in the main application once Unity is running its own one (otherwise you can imagine two Kinect managers will run at the same time). The code right now looks like:

if (Button->getTag() == "something")

// TODO Pause Kinect manager

// TODO to know once Unity Applications has been closed
// TODO resume Kinect manager


Use ShellExecuteEx instead of ShellExecute, passing the flag SEE_MASK_NOCLOSEPROCESS in the fMask field of the SHELLEXECUTEINFO structure, and then either WaitForSingleObject or RegisterWaitForSingleObject on the process handle returned in the hProcess field of the SHELLEXECUTEINFO structure.