Hello,
No, those methods are only for inter thread mashaling - you cannot
marshal it like that from the client process (presumably on one machine)
to the server (presumably on another machine or at least another
process.) You must marshall and unmarshal the interface entirely on the
server, in the server process, between the threads wanting to share the
client reference, using the shared (between the threads) FStream pointer
variable. So, to reiterate: In the receiving server object that
receives the client COM interface reference from the client (which is
running in it's own thread in the server), you must rig it so that this
thread marshalls the received interface reference, using those calls
shown previously, to any other thread context (apartment) that wants to
use it (e.g. the main application thread, or any other client thread.)
If you don't you will get the error you're getting. Read up on COM
threading. A quick google turned up these 2 links that at first glance
seems helpful:
http://www.devarticles.com/c/a/Cplusplus/COM-Threading-Models-Explained/1/
http://www.thedelphimagazine.com/samples/comthread/article.htm
HTH
Walter
reynaldi81 wrote:
>
> i have tried to use CoMarshalInterThreadInterfaceInStream to marshal
> the interface in client and CoGetInterfaceAndReleaseStream to
> unmarshal the interface in server application, but still dont solve
> the problem. it even give a new error "invalid variant type" each time
> i try to access the interface after i use the
> CoGetInterfaceAndReleaseStream.
> it seems that i have problem passing the IStream pointer from the
> client to the server , so CoGetInterfaceAndReleaseStream wont
> unmarshal the right interface.
>
> i also have tried to use the IGlobalInterfaceTable, but still dont work.
>
> thanks for any suggestion
>
> rey
>
>
> ___
[Non-text portions of this message have been removed]
.