ILockBytes Windows Mobile 6.5
ILockBytes
Windows Mobile 6.5 https://msdn.microsoft.com/zh-cn/library/aa911496(en-us,MSDN.10).aspx這個接口是一個字節數組對象上實現由一些物理存儲,如磁盤文件,全局內存或數據庫。
它使用一個組件對象模型(COM)復合文件存儲對象給其根存儲訪問物理設備,而隔離根存儲訪問物理存儲的細節。
什么時候實現大多數應用程序不會實現?ILockBytes?因為COM接口提供了實現最常見的一種情況:
基于文件的實現?如果你所說的?StgCreateDocfile?函數創建一個復合文件存儲對象,它包含的一個實現ILockBytes?這是關聯到一個字節數組存儲在一個物理磁盤文件。
復合文件存儲對象調用?ILockBytes?方法。 你不叫他們直接在這個實現。
有些情況下,這將是有用的為應用程序提供它自己的?ILockBytes?實現。
例如,一個數據庫應用程序可以實現?ILockBytes?創建一個字節數組對象支持的存儲的關系表。 然而,強烈建議您使用COM-provided實現。
討論了使用COM實現的優點,而不是創建自己的看到?StgCreateDocfileOnILockBytes?函數,它創建了一個復合文件存儲對象的調用者提供的字節數組對象。
什么時候使用的?ILockBytes?COM的實現方法?IStorage?和?IStream?復合文件對象的接口。
除非你正在實施?IStorage?和?IStream?,你不需要打電話?ILockBytes?直接的方法。
如果你寫你自己的?ILockBytes?實現,您可以使用?StgCreateDocfileOnILockBytes?函數創建一個復合文件存儲對象支持的實現?ILockBytes?。
方法下面的表顯示了這個接口的方法按字母順序排列的。
?
| 沖洗 | 確保維護的任何內部緩沖區字節數組對象寫入到存儲支持。 |
| LockRegion | 限制訪問指定范圍的字節數組。 |
| ReadAt | 讀取指定的字節數在指定偏移位置開始從一開始的數組。 |
| SetSize | 字節數組的大小變化。 |
| 統計 | 檢索?STATSTG?這個字節數組對象結構。 |
| UnlockRegion | 刪除之前限制的訪問限制在一個范圍的字節?ILockBytes:LocRegion?。 |
| WriteAt | 寫入指定數量的字節數組中指定的位置。 |
確定平臺是否支持這個接口,明白了?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 is implemented on a byte array object that 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 ImplementMost applications will not implement the?ILockBytes?interface because COM provides implementations for one of the most common situations:
File-based implementation?If you call the?StgCreateDocfile?function to create a compound file storage object, it contains an implementation of?ILockBytes?that is associated with a byte array stored in a physical disk file.
The compound file storage object calls the?ILockBytes?methods. You do not call them directly in this implementation.
There are situations in which it would be useful for an application to provide its own?ILockBytes?implementation.
For example, a database application could implement?ILockBytes?to create a byte array object backed by the storage of its relational tables. However, it is strongly recommended that you use the COM-provided implementations.
For a discussion of the advantages of using the COM implementations rather than creating your own, see the?StgCreateDocfileOnILockBytes?function, which creates a compound file storage object on top of a caller-provided byte array object.
When to UseThe?ILockBytes?methods are called by the COM implementations of the?IStorage?and?IStream?interfaces on the compound file object.
Unless you are implementing?IStorage?and?IStream, you would not 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.
MethodsThe following table shows the methods for this interface in alphabetical order.
?
| Flush | Ensures that any internal buffers maintained by the byte array object are 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 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. |
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的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: zabbix监控实践解析(历史记录附近乱
- 下一篇: CCF NOI1150 确定进制