Is it possible to add a Quit Handler to an application?

    Feb 22 2006 | 9:17 pm
    I need to add a quit handler to perform some tasks before quitting. Tasks: ask the user for saving or not its data;
    This cannot be done under closebang or notifydeleted, because: -if I open a window in the caller thread, max is then freezed -if I open a window in a thread, then the application is closed before I can do anything.
    Do you have an idea of how to do this?
    Thanks, Chris

    • Feb 23 2006 | 1:39 am
      I think we would have to add something to the API in order to support this. I think the C API supports adding quit tasks. I can't think of a way around it either. Topher
    • Jan 28 2011 | 9:41 pm
      Hi, I'm trying to do something very similar in my standalone app - there are a couple of things that need to be reset when a user quits the app. I have tried using closebang, but no luck, then I found this post... is it possible to write a quit handler in Max 5? Basically I just need to bang a couple messages out to a hardware unit so that it functions correctly without my app open - I don't need to open any windows, nothing fancy - just need to delay quitting long enough for a couple bangs to get through. Any help very appreciated, thanks so much. -Diane PS I'm on a Mac, but also trying to make this app work on both Mac and Windows, so is there a way to accomplish this for both platforms? Thanks again.