If you are using MX2004 you cna implement the #closeRequest
handler in a
-- user tried to quit your application:
-- either with Alt+F4; or clicking the close button
-- on the window chrome (assuming there is a titlebar
-- or right-clicking and choosing "Close" from the
-- application's taskbar menu; or ...