OnDisconnection event

The OnDisconnection event procedure occurs when the COM add-in is unloaded (disconnected). The add-in should perform resource clean-up operations in this event and restore any changes made to MapPoint, such as removing any added menu items.

An add-in can be unloaded in one of the following ways:

The user clears the check box next to the add-in in the COM Add-ins dialog box.

MapPoint closes. If the add-in is loaded at the time MapPoint closes, then it is unloaded. If the add-ins load behavior is set to Startup, it will be reloaded when MapPoint starts again.

Syntax

object.OnDisconnection(RemoveMode, Custom)

Part Description
object An expression that evaluates to a COM add-in.
RemoveMode Long. An integer that corresponds to how the add-in was unloaded.
ext_DisconnectionMode Value Description
ext_dm_HostShutdown
0
Add-in was unloaded when MapPoint was closed
ext_dm_UserClosed
1
Add-in was unloaded when the user cleared the corresponding check box in the COM Add-ins dialog box
Custom Variant. An empty array; ignored in COM add-ins for MapPoint.

Remarks

To make your COM add-in available to users, you must add it to the MapPoint Tools menu using the AddCommand method.