AGI UI ApplicationSend comments on this topic.
OnQuit Event (AgUiApplication)
See Also
Windows






Windows & Linux

Description

Occurs upon the application shutdown.

Syntax

[Visual Basic .NET]
Public Event OnQuit()
[C#]
public void OnQuit();
[Managed C++]
public: void OnQuit();
[Java]
public void onQuit();
[Unmanaged C++]
public: void OnQuit();

Remarks

The OnQuit event is raised by the application upon exiting to let external components such as plugins, out-of-process applications and User Interface plugins perform necessary cleanup operations before the application is terminated. Refer to the code examples below.

See Also

Example

Dim app
Set app = CreateObject("STK9.Application")

WScript.ConnectObject app, "App_"

Set root = app.Personality2

app.UserControl= True
app.Visible = True

Dim res
Set res = root.ExecuteCommand("New / Scenario Test")
Rem Set res = root.ExecuteCommand("GetReport * ""InstallInfoCon""")

Rem Dim installInfo
Rem For each l in res
Rem installInfo = installInfo & l & vbCrLf
Rem Next
Rem MsgBox installInfo

Dim stkRunning
stkRunning = True
Do While stkRunning
WScript.Sleep(100)
Loop

Sub App_OnQuit
WScript.Echo "You quit STK."
Set res = Nothing
Set root = Nothing
WScript.DisconnectObject app
Set app = Nothing
stkRunning = False
End Sub
use strict;
use Win32::OLE qw(EVENTS);
use Win32::OLE::Variant qw(:Default Nothing);

my $app = Win32::OLE->New('STK9.Application');
Win32::OLE->WithEvents($app,\&EventHandler,"IAgUiApplicationEvents");

$app->SetProperty('Visible', 0);
$app->SetProperty('UserControl', 0);

my $stk = $app->Personality2;

Print "STKv9 is ready\n";
sleep(5);


my $res = $stk->ExecuteCommand("New / Scenario Test");
Print "Scenario Created\n";

Win32::OLE->MessageLoop();


Sub EventHandler {
my ($Obj,$Event,@Args) = @_;
Print "Here is the Event: $Event\n";
If ($Event eq "OnQuit") {
$res = Nothing;
$app = Nothing;
$stk = Nothing;
Win32::OLE->QuitMessageLoop();
}
}
© 2025 Analytical Graphics, Inc. All Rights Reserved.