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.
AfxIsMemoryBlock
                                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  BOOL PASCAL AfxIsMemoryBlock( const void* p, UINT nBytes,
                                LONG* plRequestNumber = NULL );
 
  Parameter         Description
 
  <p>               A void pointer to the block of memory to be tested.
 
  <nBytes>          The length of the memory block in bytes.
 
  <plRequestNumber> A pointer to a long integer that will be filled in
                    with the memory block's allocation sequence number.
                    The variable pointed to by <plRequestNumber> will only
                    be filled in if AfxIsMemoryBlock returns TRUE.
 
  Remarks
 
  Tests a memory address to make sure it represents a currently active
  memory block that was allocated by the diagnostic version of new. It
  also checks the specified size against the original allocated size. The
  allocation sequence number that is returned in <plRequestNumber> if the
  function returns TRUE is the order in which the block was allocated
  relative to all other new allocations.
 
  Return Value
 
  TRUE if the memory block is currently allocated and the length is
  correct; otherwise FALSE.
 
  Example
 
  CAge* pcage = new CAge( 21 ); // CAge is derived from CObject
  if( AfxIsMemoryBlock( pcage, sizeof( CAge ) ) != TRUE )
      exit( 1 );   // Invalid memory
 
 
  See Also
 
  AfxIsValidAddress
 
 
                                     -♦-