ShellExecuteEx combines features of ShellExecute and CreateProcess, the most noticable feature is that it returns a PID.
PROCEDURE ShellExecuteExA EXTERNAL "shell32.dll" : DEFINE INPUT PARAMETER lpExecInfo AS LONG. DEFINE RETURN PARAMETER ReturnValue AS LONG. END PROCEDURE.
lpExecInfo is a memory-pointer to a structure of type SHELLEXECUTEINFO, which is a bit complicated to describe. Perhaps it's best to point at an example: See wait until MS-Word finished printing.