AFX_TERM_PROC AfxSetTerminate( AFX_TERM_PROC proc );
proc
The name of a termination function that will be called by AfxTerminate. Termination functions must take no arguments and return nothing.
Links AfxTerminate to the specified function. The default termination function is AfxAbort. AfxTerminate is called internally by Microsoft Foundation member functions when there is a fatal error, such as an uncaught exception.
void MyTerminateProc() // Called instead of AfxAbort
{
printf( "Out of memory!\\n" );
exit( 1 );
}
void main()
{
AfxSetTerminate( MyTerminateProc );
while ( 1 )
{
// new calls AfxTerminate if unsuccessful
BYTE * p = new BYTE[1024]; // Consume memory
printf( "consumed memory at $%x\\n", p );
}
}