IStorage
IStorage 接口支持结构化存储对象的创建和管理。 结构化存储允许分层存储在单个文件的信息,和通常被称为“文件系统内文件”。 元素的结构化存储对象存储和小溪。 存储类似于目录,和流类似于文件。 在一个结构化的存储将会有一个可能包含substorages主存储对象,可能是嵌套的,和小溪。 存储提供对象的结构,包含数据流,通过操纵 IStream 接口。
的 IStorage 接口提供了创建和管理方法根存储对象,孩子存储对象,和流对象。 这些方法可以创建、开放、枚举、移动、复制、重命名或删除元素存储对象。
应用程序必须释放它 IStorage 指针完成时所使用的存储对象来释放内存。 也有一些方法来改变一个元素的日期和时间。
有许多不同的模式的一个存储对象及其元素可以打开,通过设置值决定 STGM常量 。 这就是变化的一个方面。 你可以设置直接模式,改变一个对象会立即写,或交易模式,更改写入缓冲区,直到明确承诺。 的IStorage 接口提供了方法提交更改,并恢复到最后一次提交的版本。 例如,可以在只读模式下打开一个流或读/写模式。 有关更多信息,请参见 STGM常量 。
其他方法提供的信息通过一个存储对象及其元素 STATSTG 结构。
什么时候实现
一般来说,你不会实现这个接口,除非你是定义一个新的存储系统方案。 COM提供了一个复合文件的实现 IStorage 界面,支持事务访问。 COM提供了一组helper api来促进使用复合文件存储对象的实现。 有关更多信息,请参见 IStorage -复合文件实现。
什么时候使用
调用的方法 IStorage 在当前的存储管理substorages或流。 这种管理包括创建、打开或破坏substorages流,以及管理等方面的时间邮票,名称,等等。 你也可以提交修改或恢复到以前的版本存储在交易模式下打开。 的方法 IStorage 不包括意味着读写蠕升是预留给 IStream 管理实际的数据。 而 IStorage 和 IStream 接口是用来操作存储对象和它的元素, IPersistStorage 接口包含方法称为序列化存储对象及其元素到磁盘上的一个文件里。
成员
的 IStorage 接口继承自 IUnknown 接口。 IStorage 也有这些类型的成员:
方法
的 IStorage 接口有这些方法。
| 方法 | 描述 |
|---|---|
| 提交 |
反映了变化的事务存储对象到父级。 |
| CopyTo |
这个开放存储对象的全部内容复制到另一个存储对象。 目的地存储对象的布局可能有所不同。 |
| CreateStorage |
创建并打开一个新的存储对象在这个存储对象。 名称长度不能超过31个字符(不包括字符串结束符)。 01年至000 f的人物,作为第一个字符流/存储的名称,使用OLE保留。 这是一个复合文件的限制,而不是一个结构化的存储限制。 |
| CreateStream |
创建和打开一个流对象与指定名称包含在这个存储对象。 名称长度不能超过31个字符(不包括字符串结束符)。 01年至000 f的人物,作为第一个字符流/存储的名称,使用OLE保留。 这是一个复合文件的限制,而不是一个结构化的存储限制。 |
| DestroyElement |
删除指定的存储或流从存储对象。 |
| EnumElements |
返回一个枚举器对象,可用于枚举的存储和流对象包含在这个存储对象。 |
| MoveElementTo |
复制或移动substorage或从存储对象流到另一个存储对象。 |
| OpenStorage |
打开一个现有的存储对象与指定名称根据指定的访问模式。 名称长度不能超过31个字符(不包括字符串结束符)。 01年至000 f的人物,作为第一个字符流/存储的名称,使用OLE保留。 这是一个复合文件的限制,而不是一个结构化的存储限制。 |
| OpenStream |
打开一个现有的流对象在这个存储对象使用指定的访问权限 grfMode 。 名称长度不能超过31个字符(不包括字符串结束符)。 01年至000 f的人物,作为第一个字符流/存储的名称,使用OLE保留。 这是一个复合文件的限制,而不是一个结构化的存储限制。 |
| RenameElement |
重命名指定存储或流在这个存储对象。 |
| 回复 |
已经丢弃的所有更改存储对象自上次提交操作。 |
| SetClass |
分配指定的CLSID存储对象。 |
| SetElementTimes |
设置修改、访问和创建时间的显示存储元素,如果底层文件系统的支持。 |
| SetStateBits |
32位的状态信息存储在这个存储对象。 |
| 统计 |
返回 STATSTG 结构的开放存储对象。 |
需求
|
最低支持客户 |
Windows 2000专业(桌面应用| Windows存储应用程序) |
|---|---|
|
最低支持服务器 |
Windows 2000 Server(桌面应用| Windows存储应用程序) |
|
Header |
|
|
IDL |
|
|
Library |
|
|
DLL |
|
|
IID |
IID_IStorage is defined as 0000000B-0000-0000-C000-000000000046 |
See also
The IStorage interface supports the creation and management of structured storage objects. Structured storage allows hierarchical storage of information within a single file, and is often referred to as "a file system within a file". Elements of a structured storage object are storages and streams. Storages are analogous to directories, and streams are analogous to files. Within a structured storage there will be a primary storage object that may contain substorages, possibly nested, and streams. Storages provide the structure of the object, and streams contain the data, which is manipulated through the IStream interface.
The IStorage interface provides methods for creating and managing the root storage object, child storage objects, and stream objects. These methods can create, open, enumerate, move, copy, rename, or delete the elements in the storage object.
An application must release its IStorage pointers when it is done with the storage object to deallocate memory used. There are also methods for changing the date and time of an element.
There are a number of different modes in which a storage object and its elements can be opened, determined by setting values from STGM Constants. One aspect of this is how changes are committed. You can set direct mode, in which changes to an object are immediately written to it, or transacted mode, in which changes are written to a buffer until explicitly committed. The IStorage interface provides methods for committing changes and reverting to the last-committed version. For example, a stream can be opened in read-only mode or read/write mode. For more information, see STGM Constants.
Other methods provide access to information about a storage object and its elements through the STATSTG structure.
When to implement
Generally, you would not implement this interface unless you were defining a new storage scheme for your system. COM provides a compound file implementation of the IStorage interface that supports transacted access. COM provides a set of helper APIs to facilitate using the compound file implementation of storage objects. For more information, see IStorage - Compound File Implementation.
When to use
Call the methods of IStorage to manage substorages or streams within the current storage. This management includes creating, opening, or destroying substorages or streams, as well as managing aspects such as time stamps, names, and so forth. You also can commit changes or revert to previous version for storages opened in transacted mode. The methods of IStorage do not include means to read and write data—this is reserved for IStream, which manages the actual data. While the IStorage and IStream interfaces are used to manipulate the storage object and its elements, the IPersistStorage interface contains methods that are called to serialize the storage object and its elements to a disk file.
Members
The IStorage interface inherits from the IUnknown interface. IStorage also has these types of members:
Methods
The IStorage interface has these methods.
| Method | Description |
|---|---|
| Commit |
Reflects changes for a transacted storage object to the parent level. |
| CopyTo |
Copies the entire contents of this open storage object into another storage object. The layout of the destination storage object may differ. |
| CreateStorage |
Creates and opens a new storage object within this storage object. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction. |
| CreateStream |
Creates and opens a stream object with the specified name contained in this storage object. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction. |
| DestroyElement |
Removes the specified storage or stream from this storage object. |
| EnumElements |
Returns an enumerator object that can be used to enumerate the storage and stream objects contained within this storage object. |
| MoveElementTo |
Copies or moves a substorage or stream from this storage object to another storage object. |
| OpenStorage |
Opens an existing storage object with the specified name according to the specified access mode. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction. |
| OpenStream |
Opens an existing stream object within this storage object using the specified access permissions in grfMode. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction. |
| RenameElement |
Renames the specified storage or stream in this storage object. |
| Revert |
Discards all changes that have been made to the storage object since the last commit operation. |
| SetClass |
Assigns the specified CLSID to this storage object. |
| SetElementTimes |
Sets the modification, access, and creation times of the indicated storage element, if supported by the underlying file system. |
| SetStateBits |
Stores up to 32 bits of state information in this storage object. |
| Stat |
Returns the STATSTG structure for this open storage object. |
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps | Windows Store apps] |
|
Header |
|
|
IDL |
|
|
Library |
|
|
DLL |
|
|
IID |
IID_IStorage is defined as 0000000B-0000-0000-C000-000000000046 |
See also
IStorage的更多相关文章
- .NET面试题系列[8] - 泛型
“可变性是以一种类型安全的方式,将一个对象作为另一个对象来使用.“ - Jon Skeet .NET面试题系列目录 .NET面试题系列[1] - .NET框架基础知识(1) .NET面试题系列[2] ...
- COM 组件基础——GUID 和 接口
一.前言 书接上回,话说在 doc(Word) 复合文件中,已经解决了保存 xls(Excel) 数据的问题了.那么,接下来又要解决另一个问题:当 WORD 程序读取复合文件,遇到了 xls 数据的时 ...
- Day 1:学习Windows Phone 使用 SQLite
private void move(string fn) { StreamResourceInfo sr = Application.GetResourceStream(new Uri(fn, Uri ...
- [.NET领域驱动设计实战系列]专题十:DDD扩展内容:全面剖析CQRS模式实现
一.引言 前面介绍的所有专题都是基于经典的领域驱动实现的,然而,领域驱动除了经典的实现外,还可以基于CQRS模式来进行实现.本专题将全面剖析如何基于CQRS模式(Command Query Respo ...
- NET RichTextBox控件如何可以插入图像
本文介绍.NET RichTextBox控件如何可以插入图像,控制和ActiveX对象通过使用OLE方式,如在解释,.不幸的是,它涵盖了只用一个C源代码样本,所以我需要在托管代码(C#)实施类似的解决 ...
- GETOBJECTOPTIONS
/// <summary> /// 获取对象的选项 /// </summary> public enum GETOBJECTOPTIONS { /// <summary& ...
- StgCreateDocfileOnILockBytes复合文档
CRichEditCtrl 的ole技术 ------------ IRichEditOle --------------------------- 如需向CRichEditCtrl里面插入Ole对象 ...
- REOBJECT 结构
REOBJECT 结构 包含有关 rich edit 控件中的 OLE 或图像对象的信息. 语法 typedef struct _reobject { DWORD cbStru ...
- com学习(一)GUID 和 接口
话说在 doc(Word) 复合文件中,已经解决了保存 xls(Excel) 数据的问题了.那么,接下来又要解决另一个问题:当 WORD 程序读取复合文件,遇到了 xls 数据的时候,它该如何启动 E ...
随机推荐
- JMeter 分布式测试部署
对于并发量很大的需求,如上万并发量,受到CPU和内存的限制,单机模拟场景是实现不了的,为了让JMeter提供更大的负载能力,须使用它的分布式机制,即多台机器同时产生负载的功能. 以下参数分析可用于配置 ...
- GenericAPIView类与几个扩展类的综合使用
五个扩展类 扩展类 作用 封装的方法 状态码(成功,失败) ListModelMixin 查询多条数据 list 200 CreateModelMixin 新增一条数据 create 201,400 ...
- java的maven项目(一)
Maven项目管理工具 Svn + eclipse 约等于 maven量级 1 Maven的简介 1.1 什么是maven 是apache下的一个开源项目,是纯java开发,并 ...
- H5中使用Web Storage来存储结构化数据
在上一篇对Web Storage的介绍中,可以看到,使用Storage保存key—value对时,key.value只能是字符串,这对于简单的数据来说已经够了,但是如果需要保存更复杂的数据,比如保存类 ...
- jenkins,已令人发指的简发到如此地步了?
不用tomcat,一条命令.... java -jar jenkins.war
- 详解cookie与session的区别,讲得最透彻的一篇文章
在PHP面试中 经常碰到请阐述session与cookie的区别与联系,以及如何修改两者的有效时间. 大家都知道,session是存储在服务器端的,cookie是存储在客户端的,session依赖于c ...
- AC日记——[NOIP2015]运输计划 cogs 2109
[NOIP2015] 运输计划 思路: 树剖+二分: 代码: #include <cstdio> #include <cstring> #include <iostrea ...
- 虚拟机Visualbox安装Ubuntu Server
关于虚拟机的新建及设置,请查看<Visualbox安装Ubuntu网络设置> 从光盘启动系统中,首先是选择语言,我这里选择英文 选择英文安装Ubuntu服务器 继续选择英文 选择地理位置, ...
- csu1216( Trie )
csu1216 题意 给定一些数,求这些数中两个数的异或值最大的那个值. 分析 转化成二进制数存入字典树,比如说要查询 \(0011\) ,显然和 \(1100\) 结合最优,所以我们直接在字典树上寻 ...
- 二维偏序+树状数组【P3431】[POI2005]AUT-The Bus
Description Byte City 的街道形成了一个标准的棋盘网络 – 他们要么是北南走向要么就是西东走向. 北南走向的路口从 1 到 n编号, 西东走向的路从1 到 m编号. 每个路口用两个 ...