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.
AfxSetAllocHook
                                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  AFX_ALLOC_HOOK AfxSetAllocHook( AFX_ALLOC_HOOKpfnAllocHook );
 
  Parameter      Description
 
  <pfnAllocHook> The name of the function to call. The function must
                 return a BOOL value and accept size_t, BOOL, and long
                 arguments.
 
  Remarks
 
  Sets a hook that enables calling of the specified function each time
  memory is allocated.
 
  The hook function is described below.
 
  Hook Function
 
  The Microsoft Foundation class library debug memory allocator can call a
  user-defined hook function to allow the user to control whether to
  permit the allocation.
 
  Allocation hook functions are prototyped as:
 
  BOOL AllocHook( size_t <nSize>, BOOL <bObject>, LONG
                                                  <lRequestNumber> );
 
  Parameter          Description
 
  <nSize>            The size of the proposed memory allocation.
 
  <bObject>          TRUE if the allocation is for a CObject-derived
                     object.
 
  <lRequestNumber>   The memory allocation's sequence number.
 
  Return Value
 
  TRUE if you want to permit the allocation; otherwise FALSE.
 
 
                                     -♦-