我正在开发一个Kinect v2应用程序,它在某些时候执行一个与Kinect v2一起使用的外部Unity迷你游戏。我正在使用ShellExecute
函数,但我不确定如何在Unity应用程序关闭后实现一个通知主应用程序的回调。我需要它,因为我想在Unity运行自己的主应用程序后暂停主应用程序中的Kinect管理器(否则你可以想象两个Kinect管理器将同时运行)。现在的代码如下:
if (Button->getTag() == "something")
{
Button->SetActive(false);
// TODO Pause Kinect manager
ShellExecute(nullptr,L"open",L"UnityApplication.exe",nullptr,nullptr,SW_SHOWNORMAL);
// TODO to know once Unity Applications has been closed
// TODO resume Kinect manager
}
答案 0 :(得分:2)
使用ShellExecuteEx
代替ShellExecute
,在SEE_MASK_NOCLOSEPROCESS
结构的fMask
字段中传递标记SHELLEXECUTEINFO
,然后WaitForSingleObject
或RegisterWaitForSingleObject
hProcess
结构的SHELLEXECUTEINFO
字段中返回的流程句柄上的<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/album_cover_height"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:onClick="clikimage"
android:scaleType="fitXY" />
。