Announcement

Collapse
No announcement yet.

Last message at closedown for tray app

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

  • Last message at closedown for tray app

    Hi,
    I have a Tray application and would like to do some clean up when theapplication ends. If the user exit via my Exit menu everything is ok, BUT when some of my users just closes down the computer without closing the app in a normal way the cleanup is not executetd. What will be the message sent to the message pump to look for? I have tried WM_ Command +%WM_Close, WS_Syscommand + sc_Close, but none seem to be the right one.
    ?

    Eigil

  • #2
    WM_QUERYENDSESSION and/or WM_ENDSESSION
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Thanks Michael.

      Eigil

      Comment


      • #4
        Your Window should always at least get the WM_DESTROY too, and is a for-sure message where the End Sessions can be aborted by any app.
        sigpic
        Mobile Solutions
        Sys Analyst and Development

        Comment


        • #5
          WM_NCDESTROY is sent after WM_DESTROY. At that point you can be assured that all windows in the application have been destroyed.
          Paul Squires
          FireFly Visual Designer (for PowerBASIC Windows 10+)
          Version 3 now available.
          http://www.planetsquires.com

          Comment


          • #6
            Well, I didn't want to go that detailed, but yes the NC messages fire last. Haven't seen a post from you in a while. How's my next version of FireFly coming?

            I used to use the NC Activate messages for Top Most fixes in Win 98 too.
            sigpic
            Mobile Solutions
            Sys Analyst and Development

            Comment


            • #7
              Yes, Roger you've been a stranger too. Haven't seen you around the PlanetSquires forum for a while. FireFly 3 is coming along very well. I am very happy with it and I am pushing its development hard in order to get it done.
              Paul Squires
              FireFly Visual Designer (for PowerBASIC Windows 10+)
              Version 3 now available.
              http://www.planetsquires.com

              Comment


              • #8
                Your Window should always at least get the WM_DESTROY too, and is a for-sure message where the End Sessions can be aborted by any app.
                Um, I don't think so. WM_DESTROY is a NOTIFICATION, not an OPPORTUNITY. Besides, you don't need Windows to be exiting to get WM_DESTROY.
                Michael Mattias
                Tal Systems Inc. (retired)
                Racine WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  He wasn't wanting an opportunity, just a message that fires in all cases. Opportunity would be WM_CLOSE or an End Session message giving him the choice to stop the process. He just needs to do cleanup...which is exactly what I do in Destroy messages. He wants to cleanup when the app ends, which can be by normal means or when windows shuts down.
                  sigpic
                  Mobile Solutions
                  Sys Analyst and Development

                  Comment


                  • #10
                    My bad, I read the question as "windows ending", not application ending.

                    WM_DESTROY would be a good choice in that case... assuming you don't want to do "cleanup" before the "END FUNCTION" of WinMain/PBMain.
                    Michael Mattias
                    Tal Systems Inc. (retired)
                    Racine WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Michael,
                      WM_ENDSESSION did the trick!

                      Eigil

                      Comment

                      Working...
                      X