IStorage question

T

The Frog

Hi Everyone,

I am having to deal with a legacy application problem. I dont know
where to post this as it is not strictly a VB.Net question, but none
of the VB 6 type groups seem to contain anything except spam. If
someone can either answer my question or point me to where I can get
an answer then I would be most appreciative.

The scenario is this: I have an Access Snapshot report which needs to
be pushed into a powerpoint slide(s) as a series of EMF images. This
is not as seemingly complex as it may seem, as the snapshot stores its
'pages' as EMF's. The snapshot file is itself a compressed compound
file. What I am having trouble with is understanding the IStorage
stuff from the OLE32.dll I need to be able to implement a 'read'
operation on the streams inside (there are no sub storages and no need
to write back).

I am unable to get a clear definition of how to implement the IStorage
class in 'classic' VB without the need for dependency dll's or TLB's
which I will not be able to install on the target machines. I have had
a look at Edanmo's classes and they are not so clear as one might
assume, having many dependancies on another class for a lot of its
functionality - in short it is confusing and not easily engineered.

Does anyone have an example, or know of one, that would allow me to
open an IStorage, read the streams (enumerate and read each one in
turn), and close it again. It doesnt seekm that complex when it is
looked at this way, but I am going nuts trying to figure this out from
the MS documentation.

Any help greatly appreciated.

Cheers

The Frog
 
B

Branco Medeiros

The Frog wrote:
The scenario is this: I have an Access Snapshot report which needs to
be pushed into a powerpoint slide(s) as a series of EMF images. This
is not as seemingly complex as it may seem, as the snapshot stores its
'pages' as EMF's. The snapshot file is itself a compressed compound
file. What I am having trouble with is understanding the IStorage
stuff from the OLE32.dll I need to be able to implement a 'read'
operation on the streams inside (there are no sub storages and no need
to write back).

I am unable to get a clear definition of how to implement the IStorage
class in 'classic' VB without the need for dependency dll's or TLB's
which I will not be able to install on the target machines. I have had
a look at Edanmo's classes and they are not so clear as one might
assume, having many dependancies on another class for a lot of its
functionality - in short it is confusing and not easily engineered.
<snip>

A long time ago, when I still used VB classic, I implemented a
complete IStorage-accessing solution, where I could both read from and
write to compound storage files. I don't remember having any
dependencies on external files -- except for the core Windows dll's,
of course -- but I do remember that defining the interfaces was very
difficult because many of then used conventions that VB 5 (what I
used, then) couldn't handle without some sort of hackery.

Another thing that also comes to mind regarding the use of a sotrage
file was that listing its content was extremely annoying, having to
rely on an enumerator for an arcane structure which was (AFAIR) really
tricky to define in VB 5...

Notice however, that your compiled solution won't have any
dependencies on TLB definitions, those are used only by the compiler
itself (at least that's what I remember).

I'm at work now but later I'll dig on my ancient files and there's a
very samll chance (emphasis on small) that I still have something in a
backup dvd.

Best of luck,

Branco.
 
T

The Frog

Branco, Cor,

Thankyou both for your help with this. I have temporarily worked
around the problem with a really dirty hack type approach - reading
the file raw and parsing it byte by byte. This is ugly as hell, but it
does work, and without dependancies.

Being able to use the IStorage class directly inside an application
such as those from MS Office or AutoCAD with VBA would be extremely
beneficial. Ugly hacks work, but you just never know if you got it
100% correct......

Branco, if you do find the old code you have I would be most
appreciative. I am happy to post any alterations I make to the code
for use in a VBA type environment. My hope is to end up with a class
based object model in pure VB / VBA that can do most everything you
would want to do - effectively a wrapper for the whole set similar to
Edanmo's, but without the needing to have external file dependancies.
Compile the functionality right into something like an add-in. It
would be most helpful if you do find it.

Thankyou both for your help with this, I really appreciate it.

The Frog
 
M

Mayayana

| Branco, did you have any luck finding an old backup CD / DVD?
|
Cor told you where to ask if you still need an
answer. Personally I wouldn't call it an ugly hack
to cut out the wrapper middleman and parse a
file directly...but I'm not familiar with IStorage.

Eduardo Morcillo does a lot of interesting stuff,
but his style is quirky and he can't be bothered
to add *any* docs to his work. So it's a mixed
bag. You might want to check VBAccelerator.com.
They have at least one sample, which I think uses
Eduardo's TLBs.
(Though VBAcc has it's own shortcomings. They
like to write code that uses a lot of their own
extras, like their subclassing library. So you
typically have to do a lot of picking, weeding,
rewriting with VBAcc code.)

Note: You do *not* need to ship tyeplibs with
VB. The typelib provides necessary information
that then gets compiled into the EXE. The compiled
file doesn't use the typelib.
 
T

The Frog

Hi Mayayana,

Thanks for the response. I was looking through the Edanmo Storage
class and came to the same conclusion. The code, though effective, is
quirky, and poorly documented at best. My goal for implementing
IStorage is actually not for a VB app but for a VBA application. I am
unable to compile it due to company policy (must always leave the code
open to inspection on all systems - stupid, but not my choice). So I
am going to attempt to build a class heirarchy to represent the object
model heirarchy used in IStorage - a pure VBA wrapper with no
dependancies.

The MS online documentation is also pretty poor as it does not really
explain how all the parts fit together in the object model, it only
provides some mechanical examples to work with rather than a full
explanation. I have managed to gather enough information (I hope) to
attempt this. Lack of documentation will slow me down but not stop the
development entirely.

As for the ugly hack stuff, now that I look at it I am quite pleased
with the result :) Working with IStorage properly would still be
better for the long run IMO.

Cheers

The Frog
 
B

Branco Medeiros

The said:
Branco, did you have any luck finding an old backup CD / DVD?

Hi! Sorry for the delay.

Yeps, sort of.

I did find an old DVD with what seems to be the code I used.

From what I gathered (oh, boy, reading that code sure brought back
memories...!) you would need a modified type library for StdOle2 (not
sure of this, read on) and the actual type library for the IStdStorage
stuff. Maybe that could be a single tlib with everything in it, I
really can't remember why I used two separate tlibs... probably
because I was developing other things that needed the stdole stuff,
but I'm really not sure.

I'm hoping the modified StdOle2 tlib isn't really needed -- it's not
like you'll be dealing directly with IUnknown and IDispatch. Therefore
I'm posting only the IStorage stuff. If it seems to you that the
modified StdOle2 lib is also needed, drop a line and I'll post it here
-- it needs major edits so to prevent line wraps and I'm really trying
to avoid having to do that, since it's somewhat big =)))

As I said before, those tlibs are used by the compiler only, not by
your final application, so the only place where you'd need then is in
your development machine (** notice however that I have an extremely
fuzzy recolection of the whole echillada, therefore I may be uttering
nonsense, here. For instance, I can't remember, for the life of me,
how did I manage to compile the odl files -- which I do remember
writing -- and also how to indicate to VB that they were supposed to
be used **)

In the odl file, if you ever use it, you'll notice a -- probably
annoying -- tendency of mine of "refactoring" most parameter names,
field names and enumerator names, so they have a more VB-like flavour.
What can I say, I was young and actually hated C/C++ (the platforms
towards which the original object naming was target). This means that
you may have a *somewhat* difficulty to map the online documentation
to the actual interfaces in my tlib... =))

As an example of the level of un-VB-isms involved in dealing with
IStorage files, check out this code fragment I digged from one of the
test modules in the DVD:

<vbclassic>

Sub ListItems(ByRef Source As IStorage)
Dim objEnum As IEnumSTATSTG
Dim dStat As TStatSTG
Dim sName As String
Dim lResult As Long
Dim lCount As Long
Dim lItems As Long
If Source Is Nothing Then
Debug.Print "Storage is not open"
Else
Call Source.Stat(dStat, comDefaultStats)
With dStat
sName = SysAllocString(.NamePtr)
Call CoTaskMemFree(.NamePtr)
End With
Debug.Print "Contents of " & sName & ":"

Call Source.EnumElements(0, 0, 0, objEnum)
Do While lResult = 0
lResult = objEnum.Next(1, dStat, lCount)
If lResult = 0 Then
With dStat
sName = SysAllocString(.NamePtr)
Call CoTaskMemFree(.NamePtr)
Debug.Print vbTab & sName;
Select Case .Type
Case comStorage
Debug.Print vbTab & "Storage"
Case comStream
Debug.Print vbTab & "Stream";
Debug.Print vbTab & .SizeLSB & " bytes"
Case comLockBytes
Debug.Print vbTab & "LockBytes"
Case comProperty
Debug.Print vbTab & "Property"
Case Else
Debug.Print vbTab & "Unknown type"
End Select
End With
lItems = lItems + 1
End If
Loop
Debug.Print "Items found: " & lItems
Set objEnum = Nothing
End If
End Sub
</vbclassic>

Well, hope you can take any value from this.

Best Regards,

Branco.

The odl file. It was saved as VBCOMObjects.odl. That means you
probably can name it anythingyoulike.odl. Oh, and you will have to
compile it to a tlib. Don't look at me, I have no recollection of how
to do that:

[
uuid(CC66FD20-DD0A-11d4-8CF1-080039010D55),
version(1.0),
helpstring("COM Objects for Visual Basic")

]
library VBCOMObjects
{

importlib("STDOLE2.TLB");

typedef enum
{
comDefaultCommit = 0,
comOverwrite = 1,
comOnlyIfCurrent = 2,
comCommitToCacheOnly = 4
} ECommitFlags;

typedef enum
{
comStorage = 1,
comStream = 2,
comLockBytes = 3,
comProperty = 4
} EStorageTypes;

typedef enum
{
comFromStart = 0,
comFromCurrent = 1,
comFromEnd = 2
} ESeekOrigin;

typedef enum
{
comLockWrite = 1,
comLockExclusive = 2,
comLockOnlyOnce = 4
} ELockType;

typedef enum
{
comDefaultStats = 0,
comNoName = 1
} EStatFlags;

typedef enum
{
comDirectMode = 0x00000000,
comTransactedMode = 0x00010000,
comSimpleMode = 0x08000000
} EStgMode;

typedef enum
{
comReadAccess = 0x00000000,
comWriteAccess = 0x00000001,
comReadWriteAccess = 0x00000002
} EStgAccess;

typedef enum
{
comShareDenyNone = 0x00000040,
comShareDenyRead = 0x00000030,
comShareDenyWrite = 0x00000020,
comShareExclusive = 0x00000010
} EStgSharing;

typedef enum
{
comFailIfThere = 0x00000000,
comCreate = 0x00001000,
comConvert = 0x00020000,
comNoScratch = 0x00100000
} EStgAction;

typedef enum
{
comPriority = 0x00040000,
comDeleteOnRelease = 0x04000000
} EStgExtraFlags;


/* Auxiliary type to handle 64 bit longs */
typedef struct tagTLong64
{
long ValueLSB;
long ValueMSB;
} TLong64;

typedef struct tagTFileTime
{
long LowDateTime;
long HighDateTime;
} TFileTime;

typedef struct tagTGUID {
long Data1;
short Data2;
short Data3;
unsigned char Data4[8];
} TGUID;

typedef struct tagTStatSTG
{
long NamePtr;
EStorageTypes Type;
long SizeLSB;
long SizeMSB;
TFileTime ModifiedTime;
TFileTime CreatedTime;
TFileTime AccessedTime;
long CreationMode;
long LocksSupported;
TGUID ClassID;
long StateBits;
long Reserved;
} TStatSTG;


/////////////////////////////////////////////////////////
[
odl,
uuid(0000000c-0000-0000-C000-000000000046)
]
interface IStream : IUnknown
/////////////////////////////////////////////////////////
{

HRESULT Read(
[out] void *Buffer,
[in] long Count,
[out] long *ReadResult);

HRESULT Write(
[in] void *Buffer,
[in] long Count,
[out] long *WriteResult);

HRESULT Seek(
[in] long PositionLSB,
[in] long PositionMSB,
[in] ESeekOrigin Origin,
[out] TLong64 *SeekResult);

HRESULT SetSize(
[in] long NewSizeLSB,
[in] long NewSizeMSB);

HRESULT CopyTo(
[in] IStream *DestStream,
[in] long CountLSB,
[in] long CountMSB,
[out] TLong64 *ReadResult,
[out] TLong64 *WriteResult);

HRESULT Commit(
[in] ECommitFlags Flags);

HRESULT Revert();

HRESULT LockRegion(
[in] long OffsetLSB,
[in] long OffsetMSB,
[in] long CountLSB,
[in] long CountMSB,
[in] ELockType LockType);

HRESULT UnlockRegion(
[in] long OffsetLSB,
[in] long OffsetMSB,
[in] long CountLSB,
[in] long CountMSB,
[in] ELockType LockType);

HRESULT Stat(
[out] TStatSTG *StatSTG,
[in] EStatFlags Flags);

HRESULT Clone(
[out] IStream **NewStream);
};

/////////////////////////////////////////////////////////
[
odl,
uuid(0000000d-0000-0000-C000-000000000046)
]
interface IEnumSTATSTG : IUnknown
/////////////////////////////////////////////////////////
{

long Next(
[in] long Count,
[out] TStatSTG *Items,
[out] long *ItemsRetrieved);

long Skip(
[in] long Count);

HRESULT Reset();

HRESULT Clone(
[out] IEnumSTATSTG **Result);
};

/////////////////////////////////////////////////////////
[
odl,
uuid(0000000b-0000-0000-C000-000000000046)
]
interface IStorage : IUnknown
/////////////////////////////////////////////////////////
{


HRESULT CreateStream(
[in] BSTR Name,
[in] long Mode,
[in] long Reserved1,
[in] long Reserved2,
[out] IStream **NewStream);

HRESULT OpenStream(
[in] BSTR Name,
[in] long Reserved1,
[in] long Mode,
[in] long Reserved2,
[out] IStream **Result);

HRESULT CreateStorage(
[in] BSTR Name,
[in] long Mode,
[in] long Reserved1,
[in] long Reserved2,
[out] IStorage **Result);

HRESULT OpenStorage(
[in] BSTR Name,
[in] IStorage *PriorityStg,
[in] long Mode,
[in] long Reserved1,
[in] long Reserved2,
[out] IStorage **Result);

HRESULT CopyTo(
[in] long ExcludeCount,
[in] TGUID *ExcludeInterfaces,
[in] long ExcludeNamesPtr,
[in] IStorage *Destination);

HRESULT MoveElementTo(
[in] BSTR Name,
[in] IStorage *Destination,
[in] BSTR NewName,
[in] long Flags);

HRESULT Commit(
[in] ECommitFlags Flags);

HRESULT Revert();

HRESULT EnumElements(
[in] long Reserved1,
[in] long Reserved2,
[in] long Reserved3,
[out] IEnumSTATSTG **Result);

HRESULT DestroyElement(
[in] BSTR Name);

HRESULT RenameElement(
[in] BSTR OldName,
[in] BSTR NewName);

HRESULT SetElementTimes(
[in] BSTR Name,
[in] TFileTime *CreationTime,
[in] TFileTime *AccessedTime,
[in] TFileTime *ModificationTime);

HRESULT SetClass(
[in] TGUID* ClassID);

HRESULT SetStateBits(
[in] long StateBits,
[in] long Mask);

HRESULT Stat(
[out] TStatSTG *StatSTG,
[in] EStatFlags Flags);
};

/////////////////////////////////////////////////////////
[
dllname("ole32.dll"),
uuid(EB41CAC0-DD1B-11d4-8CF1-080039010D55),
helpstring("COM API functions")
]
module COMFunctions
/////////////////////////////////////////////////////////
{
[entry("StgIsStorageFile"),
helpstring("Checks to if the file is a Structured Storage file")]
long _stdcall AssertIsStorage(
[in] BSTR FileName);

[entry("StgCreateDocfile"),
helpstring("Creates a new compound file")]
HRESULT _stdcall StgCreateDocfile(
[in] BSTR FileName,
[in] long Mode,
[in] long Reserved,
[out] IStorage **Result);

[entry("StgOpenStorage"),
helpstring("Opens an existing compound file")]
HRESULT _stdcall StgOpenStorage(
[in] BSTR FileName,
[in] IStorage* PriorityStg,
[in] long Mode,
[in] long ExcludeNamesPtr,
[in] long Reserved,
[out] IStorage** Result);

[entry("StgSetTimes"),
helpstring("Sets the times associated with the specified file")]
HRESULT _stdcall StgSetTimes(
[in] BSTR FileName,
[in] TFileTime* CreationTime,
[in] TFileTime* AccessedTime,
[in] TFileTime* ModificationTime);

[entry("CoTaskMemFree"),
helpstring("Frees a memory address allocated by COM")]
void _stdcall CoTaskMemFree(
[in] long MemoryPtr);

};

/////////////////////////////////////////////////////////
[
dllname("oleaut32.dll"),
uuid(ECDB1C80-DD28-11d4-8CF1-080039010D55),
helpstring("Automation API functions")
]
module Automation
/////////////////////////////////////////////////////////
{
[entry("SysAllocString"),
helpstring("Creates a BSTR from a null delimited string")]
BSTR _stdcall SysAllocString(
[in] long StringPtr);
};

}
 
C

Cor

Branco,

The community of this newsgroup is not VB6, therefore is a better newsgroup.

The VB6 newsgroup is still active and reachable in the same way as you find
this newsgroup.

Microsoft.public.vb.general.languages.vb

Cor

Branco Medeiros said:
The said:
Branco, did you have any luck finding an old backup CD / DVD?

Hi! Sorry for the delay.

Yeps, sort of.

I did find an old DVD with what seems to be the code I used.

From what I gathered (oh, boy, reading that code sure brought back
memories...!) you would need a modified type library for StdOle2 (not
sure of this, read on) and the actual type library for the IStdStorage
stuff. Maybe that could be a single tlib with everything in it, I
really can't remember why I used two separate tlibs... probably
because I was developing other things that needed the stdole stuff,
but I'm really not sure.

I'm hoping the modified StdOle2 tlib isn't really needed -- it's not
like you'll be dealing directly with IUnknown and IDispatch. Therefore
I'm posting only the IStorage stuff. If it seems to you that the
modified StdOle2 lib is also needed, drop a line and I'll post it here
-- it needs major edits so to prevent line wraps and I'm really trying
to avoid having to do that, since it's somewhat big =)))

As I said before, those tlibs are used by the compiler only, not by
your final application, so the only place where you'd need then is in
your development machine (** notice however that I have an extremely
fuzzy recolection of the whole echillada, therefore I may be uttering
nonsense, here. For instance, I can't remember, for the life of me,
how did I manage to compile the odl files -- which I do remember
writing -- and also how to indicate to VB that they were supposed to
be used **)

In the odl file, if you ever use it, you'll notice a -- probably
annoying -- tendency of mine of "refactoring" most parameter names,
field names and enumerator names, so they have a more VB-like flavour.
What can I say, I was young and actually hated C/C++ (the platforms
towards which the original object naming was target). This means that
you may have a *somewhat* difficulty to map the online documentation
to the actual interfaces in my tlib... =))

As an example of the level of un-VB-isms involved in dealing with
IStorage files, check out this code fragment I digged from one of the
test modules in the DVD:

<vbclassic>

Sub ListItems(ByRef Source As IStorage)
Dim objEnum As IEnumSTATSTG
Dim dStat As TStatSTG
Dim sName As String
Dim lResult As Long
Dim lCount As Long
Dim lItems As Long
If Source Is Nothing Then
Debug.Print "Storage is not open"
Else
Call Source.Stat(dStat, comDefaultStats)
With dStat
sName = SysAllocString(.NamePtr)
Call CoTaskMemFree(.NamePtr)
End With
Debug.Print "Contents of " & sName & ":"

Call Source.EnumElements(0, 0, 0, objEnum)
Do While lResult = 0
lResult = objEnum.Next(1, dStat, lCount)
If lResult = 0 Then
With dStat
sName = SysAllocString(.NamePtr)
Call CoTaskMemFree(.NamePtr)
Debug.Print vbTab & sName;
Select Case .Type
Case comStorage
Debug.Print vbTab & "Storage"
Case comStream
Debug.Print vbTab & "Stream";
Debug.Print vbTab & .SizeLSB & " bytes"
Case comLockBytes
Debug.Print vbTab & "LockBytes"
Case comProperty
Debug.Print vbTab & "Property"
Case Else
Debug.Print vbTab & "Unknown type"
End Select
End With
lItems = lItems + 1
End If
Loop
Debug.Print "Items found: " & lItems
Set objEnum = Nothing
End If
End Sub
</vbclassic>

Well, hope you can take any value from this.

Best Regards,

Branco.

The odl file. It was saved as VBCOMObjects.odl. That means you
probably can name it anythingyoulike.odl. Oh, and you will have to
compile it to a tlib. Don't look at me, I have no recollection of how
to do that:

[
uuid(CC66FD20-DD0A-11d4-8CF1-080039010D55),
version(1.0),
helpstring("COM Objects for Visual Basic")

]
library VBCOMObjects
{

importlib("STDOLE2.TLB");

typedef enum
{
comDefaultCommit = 0,
comOverwrite = 1,
comOnlyIfCurrent = 2,
comCommitToCacheOnly = 4
} ECommitFlags;

typedef enum
{
comStorage = 1,
comStream = 2,
comLockBytes = 3,
comProperty = 4
} EStorageTypes;

typedef enum
{
comFromStart = 0,
comFromCurrent = 1,
comFromEnd = 2
} ESeekOrigin;

typedef enum
{
comLockWrite = 1,
comLockExclusive = 2,
comLockOnlyOnce = 4
} ELockType;

typedef enum
{
comDefaultStats = 0,
comNoName = 1
} EStatFlags;

typedef enum
{
comDirectMode = 0x00000000,
comTransactedMode = 0x00010000,
comSimpleMode = 0x08000000
} EStgMode;

typedef enum
{
comReadAccess = 0x00000000,
comWriteAccess = 0x00000001,
comReadWriteAccess = 0x00000002
} EStgAccess;

typedef enum
{
comShareDenyNone = 0x00000040,
comShareDenyRead = 0x00000030,
comShareDenyWrite = 0x00000020,
comShareExclusive = 0x00000010
} EStgSharing;

typedef enum
{
comFailIfThere = 0x00000000,
comCreate = 0x00001000,
comConvert = 0x00020000,
comNoScratch = 0x00100000
} EStgAction;

typedef enum
{
comPriority = 0x00040000,
comDeleteOnRelease = 0x04000000
} EStgExtraFlags;


/* Auxiliary type to handle 64 bit longs */
typedef struct tagTLong64
{
long ValueLSB;
long ValueMSB;
} TLong64;

typedef struct tagTFileTime
{
long LowDateTime;
long HighDateTime;
} TFileTime;

typedef struct tagTGUID {
long Data1;
short Data2;
short Data3;
unsigned char Data4[8];
} TGUID;

typedef struct tagTStatSTG
{
long NamePtr;
EStorageTypes Type;
long SizeLSB;
long SizeMSB;
TFileTime ModifiedTime;
TFileTime CreatedTime;
TFileTime AccessedTime;
long CreationMode;
long LocksSupported;
TGUID ClassID;
long StateBits;
long Reserved;
} TStatSTG;


/////////////////////////////////////////////////////////
[
odl,
uuid(0000000c-0000-0000-C000-000000000046)
]
interface IStream : IUnknown
/////////////////////////////////////////////////////////
{

HRESULT Read(
[out] void *Buffer,
[in] long Count,
[out] long *ReadResult);

HRESULT Write(
[in] void *Buffer,
[in] long Count,
[out] long *WriteResult);

HRESULT Seek(
[in] long PositionLSB,
[in] long PositionMSB,
[in] ESeekOrigin Origin,
[out] TLong64 *SeekResult);

HRESULT SetSize(
[in] long NewSizeLSB,
[in] long NewSizeMSB);

HRESULT CopyTo(
[in] IStream *DestStream,
[in] long CountLSB,
[in] long CountMSB,
[out] TLong64 *ReadResult,
[out] TLong64 *WriteResult);

HRESULT Commit(
[in] ECommitFlags Flags);

HRESULT Revert();

HRESULT LockRegion(
[in] long OffsetLSB,
[in] long OffsetMSB,
[in] long CountLSB,
[in] long CountMSB,
[in] ELockType LockType);

HRESULT UnlockRegion(
[in] long OffsetLSB,
[in] long OffsetMSB,
[in] long CountLSB,
[in] long CountMSB,
[in] ELockType LockType);

HRESULT Stat(
[out] TStatSTG *StatSTG,
[in] EStatFlags Flags);

HRESULT Clone(
[out] IStream **NewStream);
};

/////////////////////////////////////////////////////////
[
odl,
uuid(0000000d-0000-0000-C000-000000000046)
]
interface IEnumSTATSTG : IUnknown
/////////////////////////////////////////////////////////
{

long Next(
[in] long Count,
[out] TStatSTG *Items,
[out] long *ItemsRetrieved);

long Skip(
[in] long Count);

HRESULT Reset();

HRESULT Clone(
[out] IEnumSTATSTG **Result);
};

/////////////////////////////////////////////////////////
[
odl,
uuid(0000000b-0000-0000-C000-000000000046)
]
interface IStorage : IUnknown
/////////////////////////////////////////////////////////
{


HRESULT CreateStream(
[in] BSTR Name,
[in] long Mode,
[in] long Reserved1,
[in] long Reserved2,
[out] IStream **NewStream);

HRESULT OpenStream(
[in] BSTR Name,
[in] long Reserved1,
[in] long Mode,
[in] long Reserved2,
[out] IStream **Result);

HRESULT CreateStorage(
[in] BSTR Name,
[in] long Mode,
[in] long Reserved1,
[in] long Reserved2,
[out] IStorage **Result);

HRESULT OpenStorage(
[in] BSTR Name,
[in] IStorage *PriorityStg,
[in] long Mode,
[in] long Reserved1,
[in] long Reserved2,
[out] IStorage **Result);

HRESULT CopyTo(
[in] long ExcludeCount,
[in] TGUID *ExcludeInterfaces,
[in] long ExcludeNamesPtr,
[in] IStorage *Destination);

HRESULT MoveElementTo(
[in] BSTR Name,
[in] IStorage *Destination,
[in] BSTR NewName,
[in] long Flags);

HRESULT Commit(
[in] ECommitFlags Flags);

HRESULT Revert();

HRESULT EnumElements(
[in] long Reserved1,
[in] long Reserved2,
[in] long Reserved3,
[out] IEnumSTATSTG **Result);

HRESULT DestroyElement(
[in] BSTR Name);

HRESULT RenameElement(
[in] BSTR OldName,
[in] BSTR NewName);

HRESULT SetElementTimes(
[in] BSTR Name,
[in] TFileTime *CreationTime,
[in] TFileTime *AccessedTime,
[in] TFileTime *ModificationTime);

HRESULT SetClass(
[in] TGUID* ClassID);

HRESULT SetStateBits(
[in] long StateBits,
[in] long Mask);

HRESULT Stat(
[out] TStatSTG *StatSTG,
[in] EStatFlags Flags);
};

/////////////////////////////////////////////////////////
[
dllname("ole32.dll"),
uuid(EB41CAC0-DD1B-11d4-8CF1-080039010D55),
helpstring("COM API functions")
]
module COMFunctions
/////////////////////////////////////////////////////////
{
[entry("StgIsStorageFile"),
helpstring("Checks to if the file is a Structured Storage file")]
long _stdcall AssertIsStorage(
[in] BSTR FileName);

[entry("StgCreateDocfile"),
helpstring("Creates a new compound file")]
HRESULT _stdcall StgCreateDocfile(
[in] BSTR FileName,
[in] long Mode,
[in] long Reserved,
[out] IStorage **Result);

[entry("StgOpenStorage"),
helpstring("Opens an existing compound file")]
HRESULT _stdcall StgOpenStorage(
[in] BSTR FileName,
[in] IStorage* PriorityStg,
[in] long Mode,
[in] long ExcludeNamesPtr,
[in] long Reserved,
[out] IStorage** Result);

[entry("StgSetTimes"),
helpstring("Sets the times associated with the specified file")]
HRESULT _stdcall StgSetTimes(
[in] BSTR FileName,
[in] TFileTime* CreationTime,
[in] TFileTime* AccessedTime,
[in] TFileTime* ModificationTime);

[entry("CoTaskMemFree"),
helpstring("Frees a memory address allocated by COM")]
void _stdcall CoTaskMemFree(
[in] long MemoryPtr);

};

/////////////////////////////////////////////////////////
[
dllname("oleaut32.dll"),
uuid(ECDB1C80-DD28-11d4-8CF1-080039010D55),
helpstring("Automation API functions")
]
module Automation
/////////////////////////////////////////////////////////
{
[entry("SysAllocString"),
helpstring("Creates a BSTR from a null delimited string")]
BSTR _stdcall SysAllocString(
[in] long StringPtr);
};

}
 
T

The Frog

Branco, thankyou for this, I really appreciate it.

Cor, Branco is helping me out and it is posted here entirely because
of my misplacement of the thread. Branco was kind enough to answer and
help someone in need. I have made a note of the other VB (ie/ classic)
group and any future queries on that topic will be posted there.

Cheers

The Frog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top