@zeriab
rescue/ensure don't seem to work in ACE if you just close the window directly, it just immediately terminates the process. They will only trap exiting through normal means (eg., the in game shutdown through the menu or calling 'exit').
@tsukihime
I suppose you could make a compromise by disabling the 'x' from the window (and with it, the ability to Alt+F4 the window) by using SetClassLong.
FindWindow = Win32API.new('user32', 'FindWindow', 'pp', 'l')SetClassLong = Win32API.new('user32', 'SetClassLong', 'lil', 'i')buf = " " * 256GetPrivateProfileString.call('Game','Title','',buf,256,".\\Game.ini")buf.strip!HWND = FindWindow.call('RGSS Player', buf)SetClassLong.call(HWND, -26, 0x0200) #no exit buttonThen, you could handle exit processing internally (use an input script to trap an ALT-F4 press and perform your own display and/or combined with a mouse script and adding your own 'exit' button permanently in game). The game can also still be exited quickly or if unresponsive by right clicking the item in the task bar and choosing exit, or by just closing it in Applications tab of task manager (again, it won't give any additional messages here unless the task is completely unresponsive), and the right click menu of the program icon also still works as an explicit exit.Personally I find F12 reset much more problematic here. Sure, you can rescue that one and last minute save some data, but the damage has already been done at that point. ALT-F4 and pressing the program window X and pretty universally recognized and not really all that easy to miskey, but F12 is used by many games as a screenshot key.