 |
LockFile ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
Locks a region in an open file. Locking a region prevents other processes from accessing the region. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
BOOL LockFile(
HANDLE hFile, // handle to file
DWORD dwFileOffsetLow, // low-order word of offset
DWORD dwFileOffsetHigh, // high-order word of offset
DWORD nNumberOfBytesToLockLow, // low-order word of length
DWORD nNumberOfBytesToLockHigh // high-order word of length
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER LockFile IN kernel32;
INTEGER hFile,;
INTEGER dwFileOffsetLow,;
INTEGER dwFileOffsetHigh,;
INTEGER nNumberOfBytesToLockLow,;
INTEGER nNumberOfBytesToLockHigh
|
 |
 |
 |
| Parameters: |
 |
hFile
[in] Handle to the file with a region to be locked. The file handle must have been created with GENERIC_READ or GENERIC_WRITE access to the file (or both).
dwFileOffsetLow
[in] Specifies the low-order word of the starting byte offset in the file where the lock should begin.
dwFileOffsetHigh
[in] Specifies the high-order word of the starting byte offset in the file where the lock should begin.
nNumberOfBytesToLockLow
[in] Specifies the low-order word of the length of the byte range to be locked.
nNumberOfBytesToLockHigh
[in] Specifies the high-order word of the length of the byte range to be locked. |
 |
 |
| Return value: |
 |
| If the function succeeds, the return value is nonzero. |
 |
 |
| My comment: |
 |
| MSDN: If LockFile cannot lock a region of a file, it returns zero immediately. It does not block. To issue a file lock request that will block until the lock is acquired, use LockFileEx without LOCKFILE_FAIL_IMMEDIATELY. |
 |
 |
| Word Index links for the LockFile : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2001-09-18 12:00:00 | | Modified: | 2001-11-26 16:03:42 | Visited in last 7 days: 25 |