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.
AfxIsValidAddress
                                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  BOOL FAR PASCAL AfxIsValidAddress( const void FAR* lp, UINT nBytes,
                                     BOOL bReadWrite = TRUE );
 
  Parameter    Description
 
  <lp>         Points to the block of memory to be tested.
 
  <nBytes>     Contains the length of the memory block in bytes.
 
  <bReadWrite> Specifies whether the memory is both for reading and
               writing.
 
  Remarks
 
  Tests any memory block to ensure that it is contained entirely within
  the program's memory space. The address is not restricted to blocks
  allocated by new.
 
  NOTE: With MS-DOS real mode, only addresses with null selectors are
        invalid; all others are valid. A huge pointer cast to a FAR
        pointer cannot be used as a parameter to AfxIsValidAddress.
 
  Return Value
 
  TRUE if the specified memory block is contained entirely within the
  program's memory space; otherwise FALSE.
 
  Example
 
  char* pbuf = (char*) malloc( 10 );
  if( AfxIsValidAddress( pbuf, 10, TRUE ) != TRUE )
      exit( 1 );   // Invalid memory
 
 
  See Also
 
  AfxIsMemoryBlock
 
 
                                     -♦-