IStream 
Author Message
 IStream

i'm trying to use ImageList_Write in my control but i keep getting an
'undefined' error at compile time (not link). i am including commctrl.h and
am also using ListView_GetImageList which doesn't get an error so i know the
include is taking. when i look at commctrl.h sure enough the definitions for
IL_Write/Read are wrapped in an #ifdef. it's looking for
__IStream_INTERFACE_DEFINED__ and this apparently gets def'd in objidl.h.
this happens in both a full control and lite control but doesn't error using
a composite control.
1. how get i get this guy defined so i can use IL_Write (i tried including
objidl but got tons of other errors - duplicate definitions, etc)??
2. if the interface is defined, how come i can declare a pointer of type
IStream in my method without getting an error??


Sun, 26 Oct 2003 20:21:16 GMT  
 IStream
Hello,

Quote:
> i'm trying to use ImageList_Write in my control but i keep getting an
> 'undefined' error at compile time (not link). i am including commctrl.h
and
> am also using ListView_GetImageList which doesn't get an error so i know
the
> include is taking. when i look at commctrl.h sure enough the definitions
for
> IL_Write/Read are wrapped in an #ifdef. it's looking for
> __IStream_INTERFACE_DEFINED__ and this apparently gets def'd in objidl.h.
> this happens in both a full control and lite control but doesn't error
using
> a composite control.
> 1. how get i get this guy defined so i can use IL_Write (i tried including
> objidl but got tons of other errors - duplicate definitions, etc)??

#include <windows.h>
#include <ole2.h>
#include <commctrl.h>

Quote:
> 2. if the interface is defined, how come i can declare a pointer of type
> IStream in my method without getting an error??

IStream *pStream = NULL;
    or
IStreamPtr spStream; // in case of smart pointer (include <comdef.h> instead
of <ole2.h>)

P.S: Also there are standard OLE's stream implementations -
CreateStreamOnHGlobal, StgXXX, shell's one- SHCreateStreamOnFile...

--
Best regards,
Vadim Melnik,
{*filter*} Consultant.
_____________________________
http://www.*-*-*.com/



Sun, 26 Oct 2003 21:48:13 GMT  
 IStream
thanx,
also, i misprinted question 2. i meant to say if the interface is NOT
defined, how come i CAN declare a pointer of type IStream (without ole2.h
included)??


Quote:
> Hello,

> > i'm trying to use ImageList_Write in my control but i keep getting an
> > 'undefined' error at compile time (not link). i am including commctrl.h
> and
> > am also using ListView_GetImageList which doesn't get an error so i know
> the
> > include is taking. when i look at commctrl.h sure enough the definitions
> for
> > IL_Write/Read are wrapped in an #ifdef. it's looking for
> > __IStream_INTERFACE_DEFINED__ and this apparently gets def'd in
objidl.h.
> > this happens in both a full control and lite control but doesn't error
> using
> > a composite control.
> > 1. how get i get this guy defined so i can use IL_Write (i tried
including
> > objidl but got tons of other errors - duplicate definitions, etc)??

> #include <windows.h>
> #include <ole2.h>
> #include <commctrl.h>

> > 2. if the interface is defined, how come i can declare a pointer of type
> > IStream in my method without getting an error??

> IStream *pStream = NULL;
>     or
> IStreamPtr spStream; // in case of smart pointer (include <comdef.h>
instead
> of <ole2.h>)

> P.S: Also there are standard OLE's stream implementations -
> CreateStreamOnHGlobal, StgXXX, shell's one- SHCreateStreamOnFile...

> --
> Best regards,
> Vadim Melnik,
> {*filter*} Consultant.
> _____________________________
> http://www.*-*-*.com/



Mon, 27 Oct 2003 01:04:08 GMT  
 IStream

Quote:
> also, i misprinted question 2. i meant to say if the interface is NOT
> defined, how come i CAN declare a pointer of type IStream (without ole2.h
> included)??

What is bad with ole2.h?

Cheers,
Vadim.



Mon, 27 Oct 2003 01:42:18 GMT  
 IStream
well, nevermind question 2..
it turns out that my dll's h file (the one that gets generated each compile)
does have ole2.h included. i didn't have to add it. when i include my dll's
h file (which should include ole2) right after that i include my object's h
file which has in it an include for commctrl.h:

in my cpp file:
#include IStreamTst.h            (includes ole2)
#include IStreamTstCtl.h        (includes commctrl)

yet it still doesn't work. i still get that stupid error for IL_Write. i
have no idea why this is happening or what to do next but it has something
to do with that define of __IStream_INTERFACE_DEFINED__. any other ideas??


Quote:
> > also, i misprinted question 2. i meant to say if the interface is NOT
> > defined, how come i CAN declare a pointer of type IStream (without
ole2.h
> > included)??

> What is bad with ole2.h?

> Cheers,
> Vadim.



Mon, 27 Oct 2003 04:10:12 GMT  
 IStream
OK, the following code is successfully compiled on my PC:

#include <windows.h>
#include <ole2.h>
#include <commctrl.h>
//.. include other headers here

int main(int argc, char* argv[])
{
 IStream *pStream = NULL;
 ImageList_Write(NULL, pStream);
 return 0;

Quote:
}
> my dll's h file (the one that gets generated each compile)
> does have ole2.h included. i didn't have to add it. when i include my
dll's
> h file (which should include ole2) right after that i include my object's
h
> file which has in it an include for commctrl.h:

> in my cpp file:
> #include IStreamTst.h            (includes ole2)
> #include IStreamTstCtl.h        (includes commctrl)

> yet it still doesn't work. i still get that stupid error for IL_Write. i
> have no idea why this is happening or what to do next but it has something
> to do with that define of __IStream_INTERFACE_DEFINED__. any other ideas??

The good solutions is to use precompile headers, e.g. add these lines to
stdafx.h
#include <windows.h>
#include <ole2.h>
#include <commctrl.h>

--
Best regards,
Vadim Melnik,
{*filter*} Consultant.
_____________________________
http://www.*-*-*.com/



Mon, 27 Oct 2003 19:15:38 GMT  
 IStream
Do you have WIN32_IE defined to 0x400 or greater in your project settings?

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> well, nevermind question 2..
> it turns out that my dll's h file (the one that gets generated each
compile)
> does have ole2.h included. i didn't have to add it. when i include my
dll's
> h file (which should include ole2) right after that i include my object's
h
> file which has in it an include for commctrl.h:

> in my cpp file:
> #include IStreamTst.h            (includes ole2)
> #include IStreamTstCtl.h        (includes commctrl)

> yet it still doesn't work. i still get that stupid error for IL_Write. i
> have no idea why this is happening or what to do next but it has something
> to do with that define of __IStream_INTERFACE_DEFINED__. any other ideas??



> > > also, i misprinted question 2. i meant to say if the interface is NOT
> > > defined, how come i CAN declare a pointer of type IStream (without
> ole2.h
> > > included)??

> > What is bad with ole2.h?

> > Cheers,
> > Vadim.



Tue, 28 Oct 2003 01:41:05 GMT  
 IStream
thanx..
but i discovered something that's probably more relevant. the project in
which i don't get the compile error on IL_Write, is a full ATL control
created WITHOUT MFC support. the projects i'm having problems with are full
ATL controls created WITH MFC support. just to verify this, i created
another full control project without MFC support and sure enough, no compile
error. i'm not sure what it is about MFC support that's messing this up but
i'd say it's a major clue..


Quote:
> Do you have WIN32_IE defined to 0x400 or greater in your project settings?

> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD

> MVP VC FAQ: http://www.mvps.org/vcfaq
> =====================================



> > well, nevermind question 2..
> > it turns out that my dll's h file (the one that gets generated each
> compile)
> > does have ole2.h included. i didn't have to add it. when i include my
> dll's
> > h file (which should include ole2) right after that i include my
object's
> h
> > file which has in it an include for commctrl.h:

> > in my cpp file:
> > #include IStreamTst.h            (includes ole2)
> > #include IStreamTstCtl.h        (includes commctrl)

> > yet it still doesn't work. i still get that stupid error for IL_Write. i
> > have no idea why this is happening or what to do next but it has
something
> > to do with that define of __IStream_INTERFACE_DEFINED__. any other
ideas??



> > > > also, i misprinted question 2. i meant to say if the interface is
NOT
> > > > defined, how come i CAN declare a pointer of type IStream (without
> > ole2.h
> > > > included)??

> > > What is bad with ole2.h?

> > > Cheers,
> > > Vadim.



Tue, 28 Oct 2003 08:43:24 GMT  
 IStream
Aha... It's called WIN32_LEAN_AND_MEAN (or something similar) and is
defined in the MFC headers before including windows.h. There's
no workaround other than including the appropriate headers
yourself, because now windows.h doesn't include them. In your
case you should include commctrl.h. This is all just a guess of
course, but this is definitely one difference incurred by the
MFC support...

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> thanx..
> but i discovered something that's probably more relevant. the project in
> which i don't get the compile error on IL_Write, is a full ATL control
> created WITHOUT MFC support. the projects i'm having problems with are
full
> ATL controls created WITH MFC support. just to verify this, i created
> another full control project without MFC support and sure enough, no
compile
> error. i'm not sure what it is about MFC support that's messing this up
but
> i'd say it's a major clue..



> > Do you have WIN32_IE defined to 0x400 or greater in your project
settings?

> > --
> > =====================================
> > Alexander Nickolov
> > Microsoft MVP [VC], MCSD

> > MVP VC FAQ: http://www.mvps.org/vcfaq
> > =====================================



> > > well, nevermind question 2..
> > > it turns out that my dll's h file (the one that gets generated each
> > compile)
> > > does have ole2.h included. i didn't have to add it. when i include my
> > dll's
> > > h file (which should include ole2) right after that i include my
> object's
> > h
> > > file which has in it an include for commctrl.h:

> > > in my cpp file:
> > > #include IStreamTst.h            (includes ole2)
> > > #include IStreamTstCtl.h        (includes commctrl)

> > > yet it still doesn't work. i still get that stupid error for IL_Write.
i
> > > have no idea why this is happening or what to do next but it has
> something
> > > to do with that define of __IStream_INTERFACE_DEFINED__. any other
> ideas??



> > > > > also, i misprinted question 2. i meant to say if the interface is
> NOT
> > > > > defined, how come i CAN declare a pointer of type IStream (without
> > > ole2.h
> > > > > included)??

> > > > What is bad with ole2.h?

> > > > Cheers,
> > > > Vadim.



Tue, 28 Oct 2003 09:11:53 GMT  
 IStream
thanx to both you guys...
i now have a working test program that successfully marshalls an IStream
from one process to another, gets the imagelist and displays the icons..
in case you're interested, i ended up just defining IL_Read/Write in my own
h file -  extern "C"ing them of course.
discovered something interesting that makes the compile error look more like
a bug. the objidl.h file is included and the define for
__IStream_INTERFACE_DEFINED__ does happen. however by time commctrl.h is
included, the define is no longer there causing just those 2 lousy functions
to not be defined. i have no idea how that undef is happening and it would
be interesting to find out but i didn't want to spend the weeks necessary to
track it down. plus there was a simple enough workaround..


Quote:
> i'm trying to use ImageList_Write in my control but i keep getting an
> 'undefined' error at compile time (not link). i am including commctrl.h
and
> am also using ListView_GetImageList which doesn't get an error so i know
the
> include is taking. when i look at commctrl.h sure enough the definitions
for
> IL_Write/Read are wrapped in an #ifdef. it's looking for
> __IStream_INTERFACE_DEFINED__ and this apparently gets def'd in objidl.h.
> this happens in both a full control and lite control but doesn't error
using
> a composite control.
> 1. how get i get this guy defined so i can use IL_Write (i tried including
> objidl but got tons of other errors - duplicate definitions, etc)??
> 2. if the interface is defined, how come i can declare a pointer of type
> IStream in my method without getting an error??



Wed, 29 Oct 2003 06:04:06 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. istream, ostream, we all scream!

2. System.IO.Stream from IStream?

3. RC1 IStream and CString BUG

4. System.IO.Stream from IStream?

5. Member Function istream::seekg help

6. RWpistream/istream

7. How AtlAxCreateControlEx can load from IStream?

8. IPropertyBag & IStream

9. IStream::Write Bug.

10. Bug in IStream::Write()?

11. Access file with the IStream interface

12. Simple IStream memory or file writes?

 

 
Powered by phpBB® Forum Software