Passing Outlook objects between threads C++

  • Thread starter Dmitry Streblechenko
  • Start date
D

Dmitry Streblechenko

All of OOM objects are apartment threaded, so you need to marshall OOM
objects if you are using them on the thread different from the one where the
object was retrieved.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
M

Michael Tissington

Im using C++ VS2005 and in the main thread I establish a reference to an
Outlook Contact Item.
I call the Display method and it correctly creates an inspector and displays
the Contact.

While the Contact is open I pass a IDISPATCH pointer to the Contact to
another thread.

In the new thread I AddRef the Contact, the pointer seems good because I can
get various properties, FileAs etc.

However when I try to call the Close method I get an invalid access
exception (the method does not return with an hr result). Watching the
Inspector events, OnClose and OnCloseComplete do get called before the
exception. However the Contact is still open when the exception occures.

Any ideas please ?
 
M

Michael Tissington

Hmm, any sugestions how to do this in C++ ?

Dmitry Streblechenko said:
All of OOM objects are apartment threaded, so you need to marshall OOM
objects if you are using them on the thread different from the one where
the object was retrieved.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top