Kill my process if the other process is killed

后端 未结 2 759
甜味超标
甜味超标 2020-12-21 09:46

I want to write a code that starts a process and kills mine when the other process is killed.

Do you know good solutions?

My current code:

st         


        
2条回答
  •  春和景丽
    2020-12-21 10:36

        SHELLEXECUTEINFO ShExecInfo = { 0 };
        ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
        ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
        ShExecInfo.hwnd = NULL;
        ShExecInfo.lpVerb = NULL;
        ShExecInfo.lpFile = exeFile.c_str();
        ShExecInfo.lpParameters = "";
        ShExecInfo.lpDirectory = NULL;
        ShExecInfo.nShow = SW_SHOW;
        ShExecInfo.hInstApp = NULL;
        ShellExecuteEx(&ShExecInfo);
        ShowWindow(SW_HIDE);
        WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
        EndDialog(0);
    

提交回复
热议问题