Call ShellExecuteEx instead of ShellExecute.
Include SEE_MASK_NOCLOSEPROCESS in the fMask field of the SHELLEXECUTEINFO structure. After a successfull call of ShellExecuteEx, the hProcess field of SHELLEXECUTEINFO contains a handle to the created process.
With this handle you can call GetExitCodeProcess, which will return STILL_ACTIVE if it is still running, or it's exit code if it has stopped.
If it is stopped, do not forget to call CloseHandle with the process handle.
NOTE: STILL_ACTIVE is defined as 259. Do not call exit( ) or ExitProcess( ) with a value of 259 as exitstatus in any program, or this will not work.
Marcel