Scripting Guide

NAURTECH WEB BROWSER AND TERMINAL EMULATION FOR WINDOWS CE AND WINDOWS MOBILE
CETerm Scripting Guide Page 91
4.8 THE ONPROGRAMEXIT EVENT
The OnProgramExit event is fired just before CETerm exits. This handler can
abort the exit to keep CETerm running.
Syntax
function OnProgramExit ( )
This handler has no arguments. The function returns 0 to continue with the exit
or 1 to abort the exit.
Example
This example prevents the CETerm exit if any session is connected.
/* OnProgramExit */
function OnProgramExit ( )
{
// Don’t exit if any session is connected
for (var i=1; i<=CETerm.MaxSession; ++i)
{
if (CETerm.Session(i).IsConnected)
{
// Switch to first connected session
CETerm.PostIDA( "IDA_SESSION_S" + i, 0 );
// Abort exit
return 1;
}
}
// OK to exit
return 0;
}
4.9 THE ONPROGRAMSTART EVENT
The OnProgramStart event is fired just before CETerm starts processing user
input. All command line arguments are processed and auto-connect sessions
are connected before this event.