1
votes

How to attach a handler when the user is closing outlook?

private void ThisAddIn_Shutdown(object sender, System.EventArgs e) basicly doesn't work.

in here: VSTO Outlook integration - Outlook shutdown event for synchronization

I've found a suggestion to hook up to Explorer.Close() and Inspector.Close().

In here: http://social.msdn.microsoft.com/forums/en-US/vsto/thread/7e3c3a98-2b01-4def-a83c-f560e4672e73

Helmut is attaching a handler like this:

_Inspector = inspector as Outlook.InspectorClass;

// register for the close event - used to release ourself from memory - intercept the close event

_Inspector.InspectorEvents_Event_Close += new Outlook.InspectorEvents_CloseEventHandler(_Inspector_InspectorEvents_Event_Close);

but there is no way I could repeat it on my machine (maybe it's my newer outlook...)

Anyone could help?

1

1 Answers

-1
votes

You Must Inject file Into OUTLOOK.EXE process and in this dll you must Do Handle for WM_CLOSE message in WndProc. Try This Link : How to Handle WNDPROC. And this link explain you everything but this is about GETMINMAXINFO message you have WM_CLOSE : All About Injecting int WNDPROC