Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Dim jo As JavaObject = Me
jo.RunMethod("addShutdownHook", Null)
StartMessageLoop
End Sub
Sub Shutdown_Hook
Log("Hook event")
File.WriteString(File.DirApp, "1.txt", "test")
End Sub
#if Java
public static void addShutdownHook() {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
System.out.println("Shutdown hook");
ba.raiseEventFromDifferentThread(null, null, 0, "shutdown_hook", true, null);
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
#End If