Newbie VC6 and Structured Storage Question

Newbie VC6 and Structured Storage Question

Post by Donald Flanner » Mon, 06 Sep 1999 04:00:00



Hello Folks

I need some help - I guess I'm missing some very fundamental point
somewhere.  I am attempting to write some simple data structures as a Stream
in the Root storage of a new "docfile" - my first attempt at utilizing
structured storage files.  I, uh, well, can't get the "write to file"
function to compile.  In that function, I have declared the Storage and
Stream as:

LPSTORAGE pIStorage;
LPSTREAM  pIStream;

I create the (temporary) file using:

 hr=StgCreateDocfile(0,
STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT,
  0, &pIStorage);

When I enter the code such as the line below, as I type "pIStorage->" the
text editor automatic statement completion properly offers the associated
methods pop-up box. Among the options is the CreateStream method.   I have
entered the following statement:

 hr=pIStorage->CreateStream("CONTENTS",
  STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT,
  0, 0, &pIStream);

When I attempt to compile the functions containing this and other statements
such as pIStream->Write(...), pIStream->Release(), etc. I get error messages
only for those statements referencing IStorage and IStream methods and the
errors say:

   error C2039: 'CreateStream' : is not a member of 'IStorage'
   see declaration of 'IStorage'

or otherwise as appropriate.

I find this rather confusing since the IDE editor seems to think
CreateStream is a method of IStorage, but the compiler doesn't.  As I said,
I'm probably overlooking something obvious in my first go at this.  Can
someone please show me the error of my ways?

Thanks!

Don

 
 
 

Newbie VC6 and Structured Storage Question

Post by Alexander Nickolo » Thu, 09 Sep 1999 04:00:00


What a confusing language is C++, isn't it? You're trying to invoke
inexistent method CreateStream which takes LPCSTR as the
first parameter. There is a method with the same name which
accepts LPCWSTR as the first parameter and that's why the
auto-complete feature of VC++ kicks in and gives you the method
signature. If you have paid close attention, the parameter type is
outlined along with its name...

--
===============================
Alexander Nickolov, MCP
Panasonic Technologies Inc.
Speech Technology Laboratory

===============================


>Hello Folks

>I need some help - I guess I'm missing some very fundamental point
>somewhere.  I am attempting to write some simple data structures as a
Stream
>in the Root storage of a new "docfile" - my first attempt at utilizing
>structured storage files.  I, uh, well, can't get the "write to file"
>function to compile.  In that function, I have declared the Storage and
>Stream as:

>LPSTORAGE pIStorage;
>LPSTREAM  pIStream;

>I create the (temporary) file using:

> hr=StgCreateDocfile(0,
>STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT,
>  0, &pIStorage);

>When I enter the code such as the line below, as I type "pIStorage->" the
>text editor automatic statement completion properly offers the associated
>methods pop-up box. Among the options is the CreateStream method.   I have
>entered the following statement:

> hr=pIStorage->CreateStream("CONTENTS",
>  STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT,
>  0, 0, &pIStream);

>When I attempt to compile the functions containing this and other
statements
>such as pIStream->Write(...), pIStream->Release(), etc. I get error
messages
>only for those statements referencing IStorage and IStream methods and the
>errors say:

>   error C2039: 'CreateStream' : is not a member of 'IStorage'
>   see declaration of 'IStorage'

>or otherwise as appropriate.

>I find this rather confusing since the IDE editor seems to think
>CreateStream is a method of IStorage, but the compiler doesn't.  As I said,
>I'm probably overlooking something obvious in my first go at this.  Can
>someone please show me the error of my ways?

>Thanks!

>Don


 
 
 

1. OLE 1 and Structured Storage question

Hi,

This is an update to a question I posted a week ago.

I am writing a program that needs to get raw binary data from an Access
database.

I manually added a binary file into a table field in Access 97. Access
stores the file as an OLE Object (Thanks to some code provided by Mr.
Martel, I can see what is happening ).

When I retrieve the field, the code used converts the Ole Object into a
structured storage. Using DocFile Viewer I can see the layout of the
structure storage and have surmised that one of the streams
'|Ole10Native' contains the data I need. However, besides the size of
the stream, the stream contains some additional header information such
as the name of the file.  In fact the name of the file is included
twice.

Does anyone know how I can determine what this header information is? Is
there any reference I can use? I currently just use the MSDN library to
read up on Inside OLE and Structured Storage.

I compared two files and it looks like the header information is
variable.

Thanks,

Donald

Also,
If this is not the right newsgroup to post this into let me know. I've
decided not to post this question in several newsgroup so as not to
offend anyone.

2. I need Speech Libs

3. Structures Storage question

4. Writing to Vt100 Status Line

5. Structured Storage Question

6. Help! Cannot open Project file!

7. Wanted: Roy Soltoff's (Mr Misosys) compuserve address.

8. Newbie question: writing structures to file???

9. newbie question about VB calling structure and DB2 - Mostly about VB

10. Newbie Structure Question

11. IStream / Structured Storage

12. How to reclaim space in Structured Storage