For what you are trying to do (commandline screenshot grabbing), may I recommend Screenshot Captor's little brother: MiniCapIt is made to do exactly what you are doing and is built with same codebase as SC.

but with ShellExecuteEx() and then WaitForSingleObject() as described in my previous post i want to wait until the MiniCap executable exits (using -exit in sParameters). but i see the executable on Task manager. and the function call WaitForSingleObject() waits.