ILockBytes
Windows Mobile 6.5https://msdn.microsoft.com/zh-cn/library/aa911496 (en-us,msdn.10). aspx
This interface is implemented on a byte array object by some physical storage, such as a disk file, global memory, or a database.
It uses a Component Object Model (COM) compound file Store object to access the physical device to its root store, while isolating the root store from accessing the physical storage details.
When does it happen?
most applications do not implement ILockBytes because COM interfaces provide the most common scenario for implementation:
file-based implementation If that's what you're saying. Stgcreatedocfile function to create a compound file storage object that contains an implementation ILockBytes this is associated to a byte array stored in a physical disk file.
compound File Store object invocation ILockBytes method. You don't call them directly in this realization.
In some cases, it would be useful to provide the application with its own ILockBytes implementation.
For example, a database application can implement ILockBytes creates a byte array object that supports the stored relational table. However, it is strongly recommended that you use the com-provided implementation.
discusses the advantages of using COM implementations, rather than creating your own see stgcreatedocfileonilockbytes a function that creates a compound file that stores the object's supplied byte array object by the caller.
When to use
of the ILockBytes How to implement COM IStorage and the IStream the interface of the compound file object.
unless you are implementing IStorage and the IStream , you don't need to call ILockBytes the direct approach.
If you write about your own ILockBytes implementation, you can use stgcreatedocfileonilockbytes function to create a composite file storage object supported implementations ILockBytes .
Method
The following table shows the methods of this interface in alphabetical order.
Method |
Description |
Flush |
Ensure that any internal buffer byte array objects maintained are written to storage support. |
LockRegion |
Restricts access to a specified range of byte arrays. |
ReadAt |
Reads the specified number of bytes at the specified offset starting at the beginning of the array. |
SetSize |
The size of the byte array changes. |
Statistics |
Search STATSTG The structure of this byte array object. |
UnlockRegion |
Delete previously restricted access limit in a range of bytes ilockbytes:locregion . |
Writeat |
Writes a specified number of bytes to the specified position in the array. |
Speech
determine if the platform supports this interface and understand Determining supported COM APIs.
Requirements
Header |
Objidl.h, Objidl.idl |
Library |
Ole32.lib, Uuid.lib |
Windows Embedded CE |
Windows CE 2.0 and later |
Windows Mobile |
Windows Mobile Version 5.0 and later |
This interface was implemented on a byte array object the is backed by some physical storage, such as a disk file, global Memory, or a database.
It is used by a Component object Model (COM) compound file storage object to give its root storage access to the physical Device, while isolating the root storage from the details of accessing the physical storage.
When to Implement
Most applications won't implement the ILockBytes interface because COM provides implementations for one of the Most common situations:
file-based Implementation If the Stgcreatedocfile function to create a compound file storage object, it contains a implementation of I LockBytes that's associated with a byte array stored in a physical disk file.
The compound file storage object calls the ILockBytes methods. them directly in this implementation.
There is situations in which it would is useful for a application to provide its own ilockbytes implementation.
For example, a database application could implement ILockBytes to create a byte array object backed by the Storag E of its relational tables. However, it is strongly recommended, the com-provided implementations.
For a discussion of the advantages of using the COM implementations rather than creating your own, see the Stgcreatedocfil Eonilockbytes function, which creates a compound file storage object on top of a caller-provided byte array object.
when to use
The ILockBytes methods is called by the COM implementations of the IStorage and IStream interfaces on the Compou nd file object.
Unless you is implementing IStorage and IStream, you would don't need to call ILockBytes methods Directly.
If you write your own ilockbytes implementation, you can use the Stgcreatedocfileonilockbytes function to create A compound file storage object backed by your implementation of ILockBytes.
Methods
The following table shows the methods for this interface in alphabetical order.
Method |
Description |
Flush |
Ensures a internal buffers maintained by the byte array object is written out to the backing storage. |
LockRegion |
Restricts access to a specified range of bytes in the array. |
ReadAt |
Reads a specified number of bytes starting at a specified offset from the beginning of the array. |
SetSize |
Changes the size of the byte array. |
Stat |
Retrieves a STATSTG structure for the this byte array object. |
UnlockRegion |
Removes the access restriction on a range of bytes previously restricted with ilockbytes::locregion. |
Writeat |
Writes a specified number of bytes to a specified location in the array. |
Remarks
To determine whether the platform supports this interface, see Determining supported COM APIs.
Requirements
Header |
Objidl.h, Objidl.idl |
Library |
Ole32.lib, Uuid.lib |
Windows Embedded CE |
Windows CE 2.0 and later |
Windows Mobile |
Windows Mobile Version 5.0 and later |
ILockBytes Windows Mobile 6.5