How to release resorces allocated by Extension Manager when Lotus Notes is closed

I have a problem with Lotus Notes Extension Manager (ExtMgr_Addins in notes.ini).

I can’t catch the moment when Lotus Notes is closed (when user click close button).

It means that I don’t know when I have to release resources, allocated in MainEntryPoint of my Extension Manager.

“DLL_PROCESS_DETACH” is wrong way for me, because I use COM inside of extension Manager.

If you look int MSDN you can find next remarks: Calling functions that require DLLs other than Kernel32.dll may result in problems that are difficult to diagnose. For example, calling User, Shell, and COM functions can cause access violation errors, because some functions load other system components. Conversely, calling functions such as these during termination can cause access violation errors because the corresponding component may already have been unloaded or uninitialized.

I implemented next workable workaround for 6 and 7 versions of Lotus Notes.

In MainEntryPoint I find the main window of “Lotus Notes” and subclass of it.

The new WNDPROC waits for WM_NCDESTROY and release all my resources I want to make free.

I don’t see another and more simple way. If you know it, please, let me know.

This workaround doesn’t work for Lotus Notes 8 because the main window of it is hosted inside of another process (notes2.exe)

So, the main question is, how can I find out when I may to release all allocated resources including COM resources

Thank’s guys.

Subject: Same issue with Lotus Notes 8.0.2

Hi,

Were you able to find a solution for this problem?

I am running LN 8.0.2 and my Extension manager uses COM.

When I do Release() for my com ptr, I always get: (…ExtManager.dll) in nlnotes.exe: 0xC0000005: Access violation reading location 0x086623f8.

Does anybody know what is a right place to release resources in Extension Managers?

Does anybody know what is a right place to relase resources in Extension Managers?