|
![](/i/fill.gif) |
Thank you for your reply!
>You should check the result of CreateProcess... Why are you setting the
>bInheritHandles parameter to true? It is traditionally set to FALSE,
>unless really needed.
I do check the result, I just shortened the code a bit to be more readable
:-)
>> hProcess = ::OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false,
>> ProcessInfo.dwProcessId);
>
>No need for this call, you can use ProcessInfo.hProcess.
Are you sure? I think I've tried it but WaitForSingleObject returned
immediately. Perhaps this is OS-specific (I use Win2000). The docs state
that the SYNCHRONIZE flag is only available in NT/2000 ... After doing
another test it worked without OpenProcess(), however, this time I called
MS-DOS Povray.
>> if (::WaitForSingleObject(hProcess, 30000) == WAIT_TIMEOUT) {
>> ::TerminateProcess(hProcess, 0);
>> }
>
>Mmm, using TerminateProcess is very bad, it kills the process without
>closing DLLs, releasing memory, etc. It really should be used only in
>extreme cases, like debugging. 30s is quite short for a POV-Ray rendering,
>but now I don't know your scenes.
You're right. The TerminateProcess thing was a quick & dirty workaround to
force POV-Ray to close, I deleted it. And these 30 seconds are enough for
my needs. The problem is that I render dozens of symbol-sized images which
render very fast- and then it is really a problem if my app expects the
user to close POV-Ray manually.
>>::CloseHandle(hProcess);
>
>::CloseHandle(ProcessInfo.hThread);
>::CloseHandle(ProcessInfo.hProcess);
>
>Seems cleaner... At least, that's what Microsoft says...
Ok
>Now, I didn't answered your question... :-(
>I have a meeting, I will look closer after.
I switched to the previous MS-Dos version, which suits my needs. It's
just a pity that I can't use all the cool new features of v3.5 :-(
Thanks anyway
Ludwig
Post a reply to this message
|
![](/i/fill.gif) |