Callback Functions
Callback functions can run under certain conditions. For example, callback functions run script code only when an application starts or quits.
Callback function names include the following names:
OnFirstSandboxOwner – Called only when an application first locks the sandbox. This callback is not called if a second copy of the same application uses the same sandbox while the first copy runs. If the first application spawns a subprocess and quits, the second subprocess locks the sandbox and prevents this callback from running until all subprocesses quit and the application runs again.
OnFirstParentStart – Called before running a ThinApp executable file regardless of whether the sandbox is simultaneously owned by another captured executable file.
OnFirstParentExit – Called when the first parent process exits. If a parent process runs a child process and quits, this callback is called even if the child process continues to run.
OnLastProcessExit – Called when the last process owning the sandbox exits. If a parent process runs a child process and quits, this callback is called when the last child process exits.
The following callback example shows the OnFirstSandboxOwner and OnFirstParentExit functions.
------------------------example.vbs ---------------------------------
Function OnFirstSandboxOwner
msgbox "The sandbox owner is: " + GetCurrentProcessName
End Function
Function OnFirstParentExit
msgbox "Quiting application: " + GetCurrentProcessName
End Function
msgbox "This code will execute for all parent and child processes"