CreateProcess error
-
Hi everyone. I'm having a problem with the CreateProcess routine. I'm calling using the following: if (CreateProcess(cmdArg, cmdFileName, NULL, NULL, TRUE, DETACHED_PROCESS /*CREATE_NEW_CONSOLE */, NULL, NULL, &si, &pi) != 0){ CloseHandle(pi.hThread); CloseHandle(pi.hProcess); } It works absolutely perfrect with the execption of one thing, the Application calling this doesn't return from the CreateProcess call until the process created returns. :confused: I really need the Call to return so I can shut down the calling Process after I'm done. I looked at using WinExec but that doesn't return either. What am I missing here? What method should I use? Thanks!
-
Hi everyone. I'm having a problem with the CreateProcess routine. I'm calling using the following: if (CreateProcess(cmdArg, cmdFileName, NULL, NULL, TRUE, DETACHED_PROCESS /*CREATE_NEW_CONSOLE */, NULL, NULL, &si, &pi) != 0){ CloseHandle(pi.hThread); CloseHandle(pi.hProcess); } It works absolutely perfrect with the execption of one thing, the Application calling this doesn't return from the CreateProcess call until the process created returns. :confused: I really need the Call to return so I can shut down the calling Process after I'm done. I looked at using WinExec but that doesn't return either. What am I missing here? What method should I use? Thanks!
Something's not right in the hen house. Per the documentation, "...because CreateProcess() returns without waiting for the new process to finish its initialization."
-
Something's not right in the hen house. Per the documentation, "...because CreateProcess() returns without waiting for the new process to finish its initialization."
:wtf: OOPS... there is something wrong... CreateProcess() should return immediataly, and if you want to wait for the created process you must use : WaitForSingleObject(pi.hProcess, WAIT_OBJECT_0)... ?