The PROCESS_INFO
struct that is populated by CreateProcess
contains the PID of the new process.
Note that this will not be the PID for the ffmpeg process. It will be the PID of the cmd process. There seems little point using cmd
here. You may as well call ffmpeg directly. Then you already have the PID you need in order to kill the process.
I'm not sure how you want to go about killing the process. If you are going to call TerminateProcess
, then you need a process handle rather than a PID.
Note that CreateProcess
returns a BOOL
and not a handle. This variable naming error I have seen before and I expect that somewhere there is some sample code which made the mistake and then everybody that uses it repeats it. Sigh.