Thanks, but as far as I can tell ShellExecute returns right away and doesn't return the value returned by my launched program's main function.

I need my program to wait until the launched program stops running.

Is there a way to do this?