| LockText |
|
|
|
|
long LockText( long FilePosition, // position of region in file long NumberOfCharacters, // number of characters in region BOOL Multilock, // multiple locking flag long Format = 0, // text format long Timeout = 5 // operation timeout );
LockText( FilePosition As Long, // position of region in file NumberOfCharacters As Long, // number of characters in region Multilock As Boolean, // multiple locking flag Format As TextFormat = 0, // text format Timeout As Long = 5 // operation timeout ) As Long
| IXF_TEXT_NULLTERM | text is NULL terminated, |
| IXF_TEXT_CRLFTERM | text is CR/LF terminated, |
| IXF_TEXT_STRING | text is a raw character sequence (see Remarks); cannot be combined with other flags. |
IXFile represents text as length-prefixed by default. Actual text data in file is preceded with a long number specifying length of the text in characters. If text is formatted as length-prefixed additional 4 bytes are locked for its length prefix.
If text is formatted as NULL- or CR/LF-terminated, additional 1 byte (NULL) or 2 bytes (CR/LF) are locked for termination.
If Format has IXF_TEXT_STRING flag set, text is treated as a raw sequence of characters and length of locked region is exactly NumberOfCharacters bytes.
Multiple locking allows locking the same region or its parts many times; with this option enabled object is allowed to lock as many overlapping file regions as needed without regard to their influence on each other. Map of the locks is maintained internally by the object to guarantee correct order of unlocking - file region is physically unlocked only when there are no dependent locks active. Therefore you must assume that after calling UnLock method file region can be still physically locked. Keep in mind that multiple locking is allowed only for the same IXFile object - you cannot lock region that overlaps another region locked by other application, thread or other IXFile object.
Locked region should be eventually unlocked with UnLock method, passing lock handle returned from this method as a parameter.