Announcement

Collapse
No announcement yet.

Saving settings when Windows terminates..?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Saving settings when Windows terminates..?

    Hi all,
    When my program is terminated (clicking 'Exit', or clicking the 'X'
    on the upper right), I want the programs settings to be saved.
    I did this by using:
    Code:
    CALLBACK FUNCTION Main_DLGPROC
        SELECT CASE CBMSG
            CASE %WM_DESTROY
                SaveSettings
                 ...
    Now I noticed that when the program is still running when I shutdown Windows (2K),
    the settings aren't saved... I thought that the %WM_DESTROY message was also
    sent when windows is being shut down??
    Which message shoud I use in stead?
    Kind regards
    Eddy

    ------------------
    [email protected]
    Eddy

  • #2
    I tried the %WM_ENDSESSION message and it does the job for me.
    I first thought that using this message implied serving the %WM_QUERYENDSESSION message
    but it is not necessary.
    I think however, when you only use the %WM_ENDSESSION (like I did), it
    is possible that the %WM_ENDSESSION is called a few times in a row when some other
    application(s) answer the %WM_QUERYENDSESSION to delay the windows shutdown. But in
    my case this is not a problem.
    Eddy

    ------------------
    [email protected]
    Eddy

    Comment


    • #3
      Eddy, I am pretty sure you realize that WM_QUERYENDSESSION and WM_ENDSESSION will not be sent if a forced exit(EWX_FORCE flag is used with ExitWindowsEx() or the bForceAppsClosed parameter of InitiateSystemShutdown() is TRUE).

      I am quite sure this brute force shutdown requires a custom applet such as a resource kit ShutDown program or one you have "rolled" yourself.

      [This message has been edited by Ron Pierce (edited September 03, 2001).]

      Comment


      • #4
        Ron,
        I basically wanted to trap a 'normal' windows shutdown by the user, but
        if I could trap 'every' windows shutdown (with the exception of the user unplugging
        the power cord.. ) it would of course be better. Do you know of a more
        'universal' way to trap a windows shutdown?
        Kind regards
        Eddy


        ------------------
        [email protected]
        Eddy

        Comment

        Working...
        X