Click here to Skip to main content
15,919,028 members
Home / Discussions / COM
   

COM

 
QuestionCOM/OLE people..how to fetch controllingunknown 's outer unknown? Pin
safee ullah10-Jun-03 1:00
safee ullah10-Jun-03 1:00 
GeneralAccessing Outlook Pin
Madmaximus9-Jun-03 6:49
Madmaximus9-Jun-03 6:49 
QuestionAccessing constants via vb-script ? Pin
Brian van der Beek5-Jun-03 22:51
Brian van der Beek5-Jun-03 22:51 
AnswerRe: Accessing constants via vb-script ? Pin
Hans Ruck6-Jun-03 4:11
Hans Ruck6-Jun-03 4:11 
GeneralRe: Accessing constants via vb-script ? Pin
Anonymous6-Jun-03 4:24
Anonymous6-Jun-03 4:24 
GeneralRe: Accessing constants via vb-script ? Pin
Hans Ruck6-Jun-03 4:38
Hans Ruck6-Jun-03 4:38 
GeneralMarshalling Pin
act_x5-Jun-03 9:40
act_x5-Jun-03 9:40 
GeneralRe: Marshalling Pin
geo_m5-Jun-03 22:38
geo_m5-Jun-03 22:38 
well, in overview, it's pretty simple.
On the beginning, you have to have some interface pointer you want to marshall - say, it's IMyInterface.

You have then to call CoMarshalInterface, but for that you need to have some IStream available. This one, you can create by calling:

CreateStreamOnHGlobal(NULL, TRUE, &_pStream);

then you can call

CoMarshalInterface(_pStream, IID_IMyInterface, IMyInterface*, ctx, NULL, flags );

So referring to your question:
IStream - it is some stream pointer created before calling the marshall method. Into this stream will be written all info required for later re-construction of the interface. You can use anything what supports IStream, even your own object. The marshaller just writes some info to the stream during marshalling and later during unmarshaling he reads the info back. The CreateStreamOnHGlobal creates a built-in object that provides IStream over the memory.

REFIID - it is an IID of the interface you want to marshal. You can use even IID_IUnknown, but then after unmarshalling you'll get the IUnknown back Wink | ;)

IUnknown* - it is a pointer to the interface you want to marshal. It is IUnknown, because all COM interfaces are derived from it, so you can cast any COM interface to IUnknown.


Then you have to deliver the IStream to the another thread (or application or whatever - depending on flags), and call
CoUnmarshalInterface( stream, IID_IMyInterface, (void**)&_pMarshalledPointer );

and you are done.

If you doing it in-process and using ATL, consider using
AtlMarshalPtrInProc
and
AtlUnmarshalPtr + AtlFreeMarshalStream

They does the IStream creation for you (but they are only in-process)

I hope this helps you a bit. In case if something is unclear, don't hesitate to ask Wink | ;)
GeneralRe: Marshalling Pin
act_x6-Jun-03 8:20
act_x6-Jun-03 8:20 
GeneralRe: Marshalling Pin
geo_m6-Jun-03 21:53
geo_m6-Jun-03 21:53 
GeneralRe: Marshalling Pin
Hans Ruck6-Jun-03 2:09
Hans Ruck6-Jun-03 2:09 
GeneralGetting the width of a webbrowser frame Pin
John Oliver4-Jun-03 21:59
John Oliver4-Jun-03 21:59 
GeneralRe: Getting the width of a webbrowser frame Pin
John Oliver4-Jun-03 23:00
John Oliver4-Jun-03 23:00 
Questionhow to resolve this? Pin
safee ullah4-Jun-03 1:36
safee ullah4-Jun-03 1:36 
AnswerRe: how to resolve this? Pin
Anonymous4-Jun-03 4:39
Anonymous4-Jun-03 4:39 
GeneralRe: how to resolve this? Pin
safee ullah4-Jun-03 20:12
safee ullah4-Jun-03 20:12 
GeneralRe: how to resolve this? Pin
Anonymous5-Jun-03 0:16
Anonymous5-Jun-03 0:16 
GeneralRe: how to resolve this? Pin
safee ullah5-Jun-03 1:29
safee ullah5-Jun-03 1:29 
Generaldispinterface question Pin
Brian van der Beek3-Jun-03 21:40
Brian van der Beek3-Jun-03 21:40 
GeneralRe: dispinterface question Pin
pba_4-Jun-03 7:15
pba_4-Jun-03 7:15 
GeneralRe: dispinterface question Pin
Vi25-Jun-03 1:39
Vi25-Jun-03 1:39 
GeneralRe: dispinterface question Pin
Brian van der Beek5-Jun-03 2:07
Brian van der Beek5-Jun-03 2:07 
GeneralCOM+ Queued Components not working Pin
cfoley3-Jun-03 0:16
cfoley3-Jun-03 0:16 
GeneralIDataObject with delayed rendering Pin
jiang-lei2-Jun-03 22:44
jiang-lei2-Jun-03 22:44 
QuestionBuilding COM object for folder protection?? Pin
Lalit S. Rana2-Jun-03 19:49
Lalit S. Rana2-Jun-03 19:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.