Does anyone know how to redirect/capture modal Windows error dialogs? This is really problematic for non-interactive, command-line programs that are merely trying to run a program and capture the exit code and stdout/stderr output.
The most recent instance of this issue is a modal Windows dialog that has the following form:
The program can't start because <foo.dll> is missing from your computer. Try reinstalling the program to fix this problem.
(Where the title of the modal GUI window is "System error")
These system error dialogs can be suppressed with SetErrorMode(). In that case, CreateProcess() should fail and GetLastError() should give you the corresponding error code.