Termination and Detaching
The following describes normal termination.
Discussion
After the IDebugLoadCompleteEvent2 or IDebugEntryPointEvent2 interface continues, if there are no breakpoints, exceptions, run-time errors, or infinite loops in the application to be debugged, the program being debugged will run to completion. This is normal termination.
You must send an IDebugProgramDestroyEvent2 to implement normal termination. This requires implementing the IDebugProgramDestroyEvent2::GetExitCode method.