beezee
asked on
CreateProcess and WaitForSingleObject fails on the second of two PDF files
All
I use CreateProcess and WaitForSingleObject in Delphi 2007 to open files and wait for them to be closed.
I have found that when I open two PDF files in a row, the second WaitForSingleObject returns immediately. I have also found that this happens for jpg and tif files but not txt files. Also the second PDF takes 10 seconds longer to open than if opened by itself!
It also happens on both Vista and XP, and on a range of computers.
Am I using CreateProcess incorrectly or is it something else?
Any help would be appreciated.
Regards
Bob
I use CreateProcess and WaitForSingleObject in Delphi 2007 to open files and wait for them to be closed.
I have found that when I open two PDF files in a row, the second WaitForSingleObject returns immediately. I have also found that this happens for jpg and tif files but not txt files. Also the second PDF takes 10 seconds longer to open than if opened by itself!
It also happens on both Vista and XP, and on a range of computers.
Am I using CreateProcess incorrectly or is it something else?
Any help would be appreciated.
Regards
Bob
if CreateProcess(nil, PChar(sText), nil, nil, False,
NORMAL_PRIORITY_CLASS, nil, pFilePath, myStartupInfo, myProcessInfo) then begin
WaitForSingleObject(myProcessInfo.hProcess, INFINITE);
CloseHandle(myProcessInfo.hProcess);
CloseHandle(myProcessInfo.hThread);
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for that. I added the /n switch to Acro32.exe and it solved the problem.
Regards
Bob