Locks a region of bytes in a file opened with FCreateEx or FOpenEx.

FLockFileEx(nFileHandle, nLockOffset, nBytesToLock [, nLockMode])

Parameters

nFileHandle

A file handle retrieved from FCreateEx, FOpenEx or a windows api function.

nLockOffset

Startoffset of the section of bytes to lock in the file.

nBytesToLock

Number of bytes to lock in the file.

nLockMode (optional, additive)

default = 0

LockmodeDescription
LOCKFILE_FAIL_IMMEDIATELYThe function returns immediately if it is unable to acquire the requested lock. If this flag is not specified, the function waits.
LOCKFILE_EXCLUSIVE_LOCKThe function requests an exclusive lock. If this flag is not specified, the function requests a shared lock.

Return Value

.T. if lock was successful, .F. otherwise.

See Also

Reference

AFHandlesEx
FChSizeEx
FCloseEx
FCreateEx
FEoFEx
FFlushEx
FGetsEx
FLockFile
FOpenEx
FPutsEx
FReadEx
FSeekEx
FUnlockFile
FUnlockFileEx
FWriteEx

Used WinApi functions

LockFileEx