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


CAtlTemporaryFile::LockRange

Call this method to lock a region in the temporary 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.

Заметки

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. To successfully unlock a region, use CAtlTemporaryFile::UnlockRange, ensuring the byte range corresponds 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

См. также

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

CAtlTemporaryFile Class

CAtlTemporaryFile Members

CAtlFile::LockRange

CAtlTemporaryFile::UnlockRange