AfxSetTerminate

Syntax

AFX_TERM_PROC AfxSetTerminate( AFX_TERM_PROC proc );

Parameters

proc

The name of a termination function that will be called by AfxTerminate. Termination functions must take no arguments and return nothing.

Remarks

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.

Example

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 );

}

}

See Also

AfxAbort, AfxTerminate