For additional information about the MAPI
IMsgStore::OpenEntry() method, visit the following Microsoft Web site:
Depending on the fifth parameter in the
IMsgStore::OpenEntry() method, the sixth parameter in the
IMsgStore::OpenEntry() method returns a pointer to an IMAPIFolder object or to an
IMessage object. The issue that is described in this article is particularly
noticeable when the MAPI interfaces are wrapped in Active Template Library
(ATL) smart pointers or in Component Object Model (COM) smart pointers. Upon
destruction, the ATL smart pointer or the COM smart pointer automatically makes
calls to the COM interface
Release method that is associated with that particular COM object. If you
declare smart pointers around
IMAPIFolder and
IMsgStore and you then permit them to pass "out of existence," you
experience the handle leak that is described in this article. Therefore, make
an explicit call to the
Release method for IMAPIFolder first, and then make the call to the
Release method for IMsgStore.
For additional MAPI documentation,
see the Microsoft Platform Software Development Kit (SDK). To obtain the
Platform SDK, visit the following Microsoft Web site: