namespace::ReleaseDispatch() hangs my client app if Outlook has been closed while my app is running

R

robert.a.mcguire

My C++ app uses the Outlook Object Model (OOM) to maniplate contacts in
Microsoft Outlook. At the end of the manipulations, I do all the stuff
necessary to shut down, i.e.,

m_oItems.ReleaseDispatch();
m_oFolder.ReleaseDispatch();
m_oNameSpace.Logoff(); /***/
m_oNameSpace.ReleaseDispatch();

But I have discovered that my app hangs infinitely on the line
commented with /***/ above (or on whatever the first line is that
references m_oNameSpace) anytime a separate running instance of the MS
Outlook app has been *closed* during my app's processing using the OOM.


I assume this is because when I logon to the NameSpace in the first
place, either my app attaches to Outlook, if it is running (and when
Outlook closes, it swipes the namespace out from under me) or when
Outlook opens after I have my app running, Outlook attaches to the same
namespace and then kills it when it closes. Does anyone have any idea
what to do about this?

Thanks.
 

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