The Initialize method initializes object, sets mode of operation and allocates internal data buffer.
long Initialize(
  long Mode = IXF_MODE_RDWR_CLOSE,                    // mode of operation
  long BufferSize = 16384                             // buffer size
  Mode As ModeOfOperation = IXF_MODE_RDWR_CLOSE,      // mode of operation
  BufferSize As Long = 16384                          // buffer size
) As Long


Mode of operation, specified as a combination of the following values:

IXF_MODE_READ read access to the object,
IXF_MODE_WRITE write access to the object,
IXF_MODE_CLOSE automatically close file on object destruction,
IXF_MODE_READLOCK automatically lock file on read operations,
IXF_MODE_WRITELOCK automatically lock file on write operations,
IXF_MODE_BIGEND read and write data in big-endian byte order.

Commonly used modes of operation are predefined for convenience:

IXF_MODE_RDWR read and write access to the object,
IXF_MODE_RDWRLOCK automatically lock file on read and write operations,
IXF_MODE_RDWR_CLOSE read and write access to the object with automatic file closing.
Size of internal data buffer, in bytes.

Return Values

If the method succeeds, the return value is 0.
If the method fails, the return value is failure code and error code is set. Call GetError to get error code.


IXF_MODE_READ and IXF_MODE_WRITE flags determine type of access to the object and not to the attached file. If mode of operation has IXF_MODE_READ flag set data can be read with Get methods. If mode of operation has IXF_MODE_WRITE flag set data can be written with Put methods. Whenever method for reading or writing data is called, mode of operation of the object is checked to ensure that requested access is compatible with access mode of the object, regardless of the type of access to the file. In other words it is not possible to write data to file if mode of operation does not have IXF_MODE_WRITE flag set, even if file is opened with write access.

IXF_MODE_CLOSE flag specifies that file is automatically closed on object destruction or whenever new file is opened or attached to the object. Regardless of this flag Close method can be called to unconditionally close file.

IXF_MODE_READLOCK and IXF_MODE_WRITELOCK flags enable automatic file locking on read and write operations. When automatic file locking is enabled, region in file of appropriate size and position is locked before read or write operation takes place; when operation completes region is unlocked. File locking guarantees that entire data read from file or written to file is consistent and is not corrupted by another application or thread. Automatic file locking makes use of multiple locking and therefore can be intermixed with manual locking. See Locking File for more information on regular and multiple file locking.

IXF_MODE_BIGEND flag specifies that data is stored in file in big-endian byte order. When this flag is set, data read from file is converted to little-endian byte order and data written to file is converted to big-endian byte order. By default little-endian byte order is used (Intel platform).

Method must be called before any other operation takes place, just after setting license key for the object.

See Also

GetMode, GetBufferSize, SetActiveBufferSize, Object Creation and Initialization