How to programmatically handle PowerPoint close event in Office Com add-ins?

I am using a generic office plugin add-on.

Can anyone tell me how to handle the closing event (the [X] button of my window) programmatically in POWER POINT COM add-ins.

Thanks in advance

0


a source to share


1 answer


Since Shared Add-ins implements the interface IDTExtensibility2

, you must implement the OnBeginShutdown

and methods OnDisconnection

. OnDisconnection

will be called whenever your add-in is unloaded, OnBeginShutdown

will be called when the host application i.e. PowerPoint, in your case, will be closed:

/// <summary>
///      Implements the OnBeginShutdown method of the IDTExtensibility2 interface.
///      Receives notification that the host application is being unloaded.
/// </summary>
/// <param term='custom'>
///      Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public virtual void OnBeginShutdown(ref System.Array custom)
{
     // do clean-up when PowerPoint exits.
}

      



Note that you might rather consider the add-in unload event than the host shutdown event, as the unload event is where your add-in cleanup should happen.

0


a source







All Articles