ShellExecute(NULL,"open","deal.exe","c:\\","H:\\",SW_HIDE);我用一个循环调用这个deal.exe,怎么知道已经执行完毕?
谢谢帮助!

解决方案 »

  1.   

    执行完了后弹出个MessageBox 不就行了
      

  2.   

    用createprocess()可以监视进程状态, ShellExecute () 不行CreateProcess( NULL, // No module name (use command line). 
            (LPTSTR)(LPCTSTR)( cszFn1), // Command line. 
            NULL,             // Process handle not inheritable. 
            NULL,             // Thread handle not inheritable. 
            FALSE,            // Set handle inheritance to FALSE. 
            0,                // No creation flags. 
            NULL,             // Use parent's environment block. 
            NULL,             // Use parent's starting directory. 
            &start,              // Pointer to STARTUPINFO structure.
            &proc );             // Pointer to PROCESS_INFORMATION structure.if (WaitForSingleObject(proc.hProcess, INFINITE)
    != WAIT_FAILED)
    {
       // yours
    }
      

  3.   

    也可以用ShellExecuteExSHELLEXECUTEINFO ShExecInfo = {0};
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb = "open";
    ShExecInfo.lpFile = "deal.exe";        
    ShExecInfo.lpParameters = "C:\\";    
    ShExecInfo.lpDirectory = "E:\\";
    ShExecInfo.nShow = SW_HIDE;
    ShExecInfo.hInstApp = NULL;    if(ShellExecuteEx(&ShExecInfo))
    {WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
    CloseHandle(ShExecInfo.hProcess);
    //程序执行完了
    }