Поделиться через


CAtlFile::LockRange

Call this method to lock a region in the file to prevent other processes from accessing it.

HRESULT LockRange(
   ULONGLONG nPos,
   ULONGLONG nCount 
) throw( );

Параметры

  • nPos
    The position in the file where the lock should begin.

  • nCount
    The length of the byte range to be locked.

Возвращаемое значение

Returns S_OK on success, or an error HRESULT on failure.

Заметки

Calls LockFile to lock a region in the file. 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 a region, using CAtlFile::UnlockRange, the byte range must correspond exactly to the region that was previously locked. LockRange does not merge adjacent regions; if two locked regions are adjacent, you must unlock each separately.

Требования

Header: atlfile.h

См. также

Основные понятия

CAtlFile Class

CAtlFile Members

CAtlFile::UnlockRange