OnTerminate (XSIApplication)

Description

Fired when the XSI application terminates.

This event is installed using the XSIApplication.Advise method and can be removed using the XSIApplication.Unadvise method, please see these methods for a detailed example of installing and uninstalling events.

The event may be temporarily muted via the EventInfo.Mute property. All installed events can be viewed in the plugin manager dialog's event tab.

NOTE: The prefered and alternative method of installing this is event is as a self-installing plugin. See PluginRegistrar.RegisterEvent method for more details.

Scripting Syntax

    XSIApplication.OnTerminate ([CustomData], [ApplicationModule])

Parameters

Parameter | Type | Description
CustomData | Variant | Custom data passed to the event handler. This argument is optional; you can specify one when binding an event with XSIApplication.Advise. The data is passed to the event handler whenever the event is fired, an empty value is passed if no custom data is specified.
ApplicationModule | Long | The application module handle; only useful for C++/COM clients.

Examples

1. VBScript Example

    function XSIApplication_OnTerminate( CustomData, Module )
       call Application.LogMessage( "*** VBScript Event - XSIApplication_OnTerminate ***")
    end function

2. JScript Example

    function XSIApplication::OnTerminate( CustomData, Module )
    {
       Application.LogMessage( "*** JScript Event - XSIApplication::OnTerminate ***");
       // your code here
    }

3. PerlScript Example

    sub XSIApplication_OnTerminate
    {
       my ($CustomData, $Module) = @_;
       $Application->LogMessage( "*** PerlScript Event - XSIApplication_OnTerminate ***" );
       # your code here
    }

4. Python Example

    def XSIApplication_OnTerminate( data, module ):
       Application.LogMessage( '*** PythonScript Event - XSIApplication_OnTerminate ***' )
       # your code here
       return 0

5. C++ Example

    //
    // This example illustrates how to implement an event handler for the
    // OnTerminate event in C++/COM.
    //
    HRESULT WINAPI XSIOnEvent
    (
       LONG        in_lEventID,
       LPVARIANT   in_pVar,
       LONG        in_lNum
    )
    {
       switch (in_lEventID)
       {
           case siOnTerminate:
           {
              TerminateMyDB(in_pVar[0]);
           }
           break;
       };
       return S_OK;
    }

See Also

PluginRegistrar.RegisterEvent | XSIApplication.Advise | XSIApplication.Unadvise | XSIApplication.EventInfos