2007-06-17, 05:57 AM
First my advance warning that I've never done VB6 development. I'm also making some assumptions about what exactly ZProcess does, but I'd do it something like this:
1) make a global variable with the 'Dim hProcess As Long'
2) immediately after you launch ffmpeg, call the "hProcess = OpenProcess(...)" call to open the process
3) start a timer with some frequency you'd be happy with (250ms, 500ms, whatever suits)
4) in the timer event, call the "GetExitCodeProcess()" function to check if it has exited
4.1) when it does exit, stop the timer, do whatever logging you want, then call "CloseHandle(hProcess)"
4.2) shutdown zprocess.
With this logic, it gets rid of the tight loop you have checking for the exit code, and zprocess should use virtually no CPU.
1) make a global variable with the 'Dim hProcess As Long'
2) immediately after you launch ffmpeg, call the "hProcess = OpenProcess(...)" call to open the process
3) start a timer with some frequency you'd be happy with (250ms, 500ms, whatever suits)
4) in the timer event, call the "GetExitCodeProcess()" function to check if it has exited
4.1) when it does exit, stop the timer, do whatever logging you want, then call "CloseHandle(hProcess)"
4.2) shutdown zprocess.
With this logic, it gets rid of the tight loop you have checking for the exit code, and zprocess should use virtually no CPU.