Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
AfxSetTerminate
                                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  AFX_TERM_PROC AfxSetTerminate( AFX_TERM_PROC proc );
 
  Parameter   Description
 
  <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
 
 
                                     -♦-