#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    72
    Rep Power
    16

    Detecting When A Program Shuts


    Hello,

    I was wondering if it is possible for a hook to be called when a program is closing, the reason being so I can clean up and save any files I currently have open.

    I heard that I could hook WM_QUIT and WM_DESTROY, but unsure on how to do this. The type of application I have is a Console.

    Thanks,

    Dead6re
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Posts
    25
    Rep Power
    0
    as the programmer, you decide when the program exits... so before it closes just run any methods you need ran.
  4. #3
  5. Jeenyus
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Location
    New Jersey
    Posts
    92
    Rep Power
    22
    I don't think thats what he meant. Like if you have an unsaved document open in Word, and try to click the X in the corner to exit, it prompts you to save changes.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    USA
    Posts
    334
    Rep Power
    15
    Have a look at the atexit() function.

    Comments on this post

    • dead6re agrees : Thanks

IMN logo majestic logo threadwatch logo seochat tools logo