Re: ATL threading problem using client COM interface

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

So what you are saying is that in my COM server, when I want to pass a
client interface pointer from the main thread in my STA to my worker
thread, I need to use one of the techniques above ? Do any of the COM
smart pointers ( CComPtr, CComQIPtr, or _com_ptr_t ) provide an easy way
to marshall the underlying interface pointer from one thread on the
server to another ? Thanks !

CComPtr and CComQIPtr don't marshal, they are just wrapping the raw
interface pointers. Use mentioned above APIs or "GIT" template to pass
pointer between apartments marshaling it.

Roman
.



Relevant Pages

  • Re: ATL threading problem using client COM interface
    ... background processing and that client COM interface is passed to the ... client interface pointer from the main thread in my STA to my worker ... You would also need to initialize COM on your worker thread - it ... way to marshall the underlying interface pointer from one thread on ...
    (microsoft.public.vc.atl)
  • CComPtr
    ... In the book ATL Internals, it is mentioned, the properties of CComPtr is, ... Release the encapsulated interface pointer when the class destructor executes; ... Automatically releases its interface pointer during exception handling, ...
    (microsoft.public.vc.language)