WaitForSingleObject Fails
Hello,
I have the following code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
SHELLEXECUTEINFO ExecuteInfo;
memset(&ExecuteInfo, 0, sizeof(ExecuteInfo)); // Reseting ExecuteInfo
ExecuteInfo.cbSize = sizeof(ExecuteInfo); // Size
ExecuteInfo.fMask = NULL;
ExecuteInfo.hwnd = NULL;
ExecuteInfo.lpVerb = "open"; // Operation to perform
ExecuteInfo.lpFile = "D:\\ffmpeg"; // Application name
ExecuteInfo.lpParameters = ConvertCall.c_str(); // Additional parameters
ExecuteInfo.lpDirectory = NULL; // Default directory
ExecuteInfo.nShow = SW_HIDE; // Hide the ShellExecute
ExecuteInfo.hInstApp = 0;
ShellExecuteEx(&ExecuteInfo);
DWORD s = WaitForSingleObject(ExecuteInfo.hProcess,INFINITE);
|
My problem is, WaitForSingleObject allways fails... (s is getting the value of 4294967295 which means it failed)
I have called GetLastError, and I am getting the error of : "Handle is invalid" Why so ?
Why does it allways fail ? I need the program to wait untill ShellExecuteEx finishes completely.
Thanks!
Last edited on
I don't know for sure. When I used similar code I had
|
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
|
and
|
ShExecInfo.lpVerb = NULL;
|
and most of the rest was pretty similar to what you have.
Thank you!!
I have done some testings, and figured the line
|
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
|
have caused me the problems, and once I used SEE_MASK_NOCLOSEPROCESS, everything went great!
Topic archived. No new replies allowed.