Class TStructuredStorage (unit E_StgStr)

Inherits from

TObject

****************************************************************** E_StgStor Ole Structured Storage Helper Routines. This unit has been modified relative to changes to Delphi 3 and will not compile properly under Delphi 2. In particular, Delphi 2 used a vtable interface to IStorage and IStream and D3 uses StdCall. IUnknown has become a system interface and (although I have no first hand knowledge of this) it is no longer necessary to call Release direcly, rather the Interfaces are released when they go out of context. If anyone knows to the contrary, I will be more than humble if you correct me.

Constructors


Constructor Create ;

---------------} (* STGM_DIRECT = $00000000; STGM_TRANSACTED = $00010000; STGM_SIMPLE = $08000000; STGM_READ = $00000000; STGM_WRITE = $00000001; STGM_READWRITE = $00000002; STGM_SHARE_DENY_NONE = $00000040; STGM_SHARE_DENY_READ = $00000030; STGM_SHARE_DENY_WRITE = $00000020; STGM_SHARE_EXCLUSIVE = $00000010; STGM_PRIORITY = $00040000; STGM_DELETEONRELEASE = $04000000; STGM_CREATE = $00001000; STGM_CONVERT = $00020000; STGM_FAILIFTHERE = $00000000; *) (******************************************************************* Structured Storage Object to help relieve some of pain when dealing with some of it's peculiarities.


Functions

Function CreateStorageFile(Const FileName : String; grfMode : LongInt) : Boolean;

****************************************************************** CreateStorageFile Create an Ole Structured Storage File

Function CreateStream(Var Storage : IStorage; Const StreamName : String; grfMode : LongInt; Var Stream : IStream) : Boolean;

****************************************************************** Create an Ole Stream within the current storage

Function CreateSubStorage(Const FileName : String; grfMode : LongInt; Var Storage : IStorage; Var SubStorage : IStorage) : Boolean;

****************************************************************** CreateSubStorage Create Sub Storage within a Storage.

Procedure DoneStorage(Var Storage : IStorage);

****************************************************************** Free up an OLE storage.

Procedure DoneStream(Var Stream : IStream);

****************************************************************** Free up an OLE stream.

Function IsStorageFile(Const FileName : String) : Boolean;

****************************************************************** IsStorageFile See if FileName is indeed a structured storage file.

Function OpenStorageFile(Const FileName : String; grfMode : LongInt) : Boolean;

****************************************************************** OpenStorageFile Open an Ole Structured Storage File

Function OpenStream(Var Storage : IStorage; Const StreamName : String; grfMode : LongInt; Var Stream : IStream) : Boolean;

****************************************************************** Create an Ole Stream within the current storage

Function OpenSubStorage(Const FileName : String; grfMode : LongInt; Var Storage : IStorage; Var SubStorage : IStorage) : Boolean;

****************************************************************** OpenSubStorage Open an Ole Structured sub-Storage within a storage

Function ReadInt(Var Stream : IStream; Var TInt : Integer) : Boolean;

****************************************************************** ReadInt Read a string from an opened storage stream.

Function ReadString(Var Stream : IStream; Var S : String) : Boolean;

****************************************************************** ReadString Read a string from an opened storage stream.

Function WriteInt(Var Stream : IStream; TInt : Integer) : Boolean;

****************************************************************** WriteInt Write an Integer to the stream.

Function WriteString(Var Stream : IStream; Const S : String) : Boolean;

****************************************************************** WriteString Write a string to an opened storage stream.

Destructor Destroy;


Properties

Events

Variables

hr : HResult;


StorageFile : IStorage;


FFileName : String;



Constructors


Constructor Create ;

---------------} (* STGM_DIRECT = $00000000; STGM_TRANSACTED = $00010000; STGM_SIMPLE = $08000000; STGM_READ = $00000000; STGM_WRITE = $00000001; STGM_READWRITE = $00000002; STGM_SHARE_DENY_NONE = $00000040; STGM_SHARE_DENY_READ = $00000030; STGM_SHARE_DENY_WRITE = $00000020; STGM_SHARE_EXCLUSIVE = $00000010; STGM_PRIORITY = $00040000; STGM_DELETEONRELEASE = $04000000; STGM_CREATE = $00001000; STGM_CONVERT = $00020000; STGM_FAILIFTHERE = $00000000; *) (******************************************************************* Structured Storage Object to help relieve some of pain when dealing with some of it's peculiarities.


Functions


Function CreateStorageFile(Const FileName : String; grfMode : LongInt) : Boolean;

****************************************************************** CreateStorageFile Create an Ole Structured Storage File


Function CreateStream(Var Storage : IStorage; Const StreamName : String; grfMode : LongInt; Var Stream : IStream) : Boolean;

****************************************************************** Create an Ole Stream within the current storage


Function CreateSubStorage(Const FileName : String; grfMode : LongInt; Var Storage : IStorage; Var SubStorage : IStorage) : Boolean;

****************************************************************** CreateSubStorage Create Sub Storage within a Storage.


Procedure DoneStorage(Var Storage : IStorage);

****************************************************************** Free up an OLE storage.


Procedure DoneStream(Var Stream : IStream);

****************************************************************** Free up an OLE stream.


Function IsStorageFile(Const FileName : String) : Boolean;

****************************************************************** IsStorageFile See if FileName is indeed a structured storage file.


Function OpenStorageFile(Const FileName : String; grfMode : LongInt) : Boolean;

****************************************************************** OpenStorageFile Open an Ole Structured Storage File


Function OpenStream(Var Storage : IStorage; Const StreamName : String; grfMode : LongInt; Var Stream : IStream) : Boolean;

****************************************************************** Create an Ole Stream within the current storage


Function OpenSubStorage(Const FileName : String; grfMode : LongInt; Var Storage : IStorage; Var SubStorage : IStorage) : Boolean;

****************************************************************** OpenSubStorage Open an Ole Structured sub-Storage within a storage


Function ReadInt(Var Stream : IStream; Var TInt : Integer) : Boolean;

****************************************************************** ReadInt Read a string from an opened storage stream.


Function ReadString(Var Stream : IStream; Var S : String) : Boolean;

****************************************************************** ReadString Read a string from an opened storage stream.


Function WriteInt(Var Stream : IStream; TInt : Integer) : Boolean;

****************************************************************** WriteInt Write an Integer to the stream.


Function WriteString(Var Stream : IStream; Const S : String) : Boolean;

****************************************************************** WriteString Write a string to an opened storage stream.


Destructor Destroy;


Properties


Events


Variables


hr : HResult;


StorageFile : IStorage;


FFileName : String;