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.
CFile::LockRange
CFile                                       Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  virtual void LockRange( DWORD dwPos, DWORD dwCount )
  throw( CFileException );
 
  Parameter   Description
 
  <dwPos>     The byte offset of the start of the byte range to lock.
 
  <dwCount>   The number of bytes in the range to lock.
 
  Remarks
 
  Locks a range of bytes in an open file, throwing an exception if the
  file is already locked. Locking bytes in a file prevents access to those
  bytes by other processes. You can lock more than one region of a file,
  but no overlapping regions are allowed.
 
  When you unlock the region, using the UnlockRange member function, the
  byte range must correspond exactly to the region that was previously
  locked. The LockRange function does not merge adjacent regions; if two
  locked regions are adjacent, you must unlock each region separately.
 
  Under MS-DOS, you must enable file sharing by running SHARE.EXE before
  running an application using this member function. You can do this in
  AUTOEXEC.BAT.
 
  NOTE: This function is not available for the CMemFile-derived class.
 
  Example
 
  extern DWORD dwPos;
  extern DWORD dwCount;
  extern CFile cfile;
  cfile.LockRange( dwPos, dwCount );
 
 
  See Also
 
  CFile::UnlockRange
 
 
                                     -♦-