Use a Callback Function
- Last UpdatedSep 12, 2025
- 1 minute read
You can use a callback function (with the OnEvent function) to perform housekeeping tasks before the system shuts down. You would normally call OnEvent in the main startup function (defined with the [Code]Startup parameter). Each time a Shutdown() call is made, the callback function is run.
/* A user shutdown procedure. */
INT
FUNCTION
MyStartupFunction()
...
OnEvent(25, MyShutdown);
...
END
INT
FUNCTION
MyShutdown()
STRING sPath;
// Perform housekeeping tasks
...
sPath = ProjectCurrentGet();
If sPath = "ProjectA" Then
ProjectSet("ProjectB");
Else
ProjectSet("ProjectA");
END
Shutdown("Everybody", sPath, 2);
END