Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. run at shutdown ...

run at shutdown ...

Scheduled Pinned Locked Moved C / C++ / MFC
windows-adminperformancequestion
17 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _moved
    wrote on last edited by
    #1

    is there any way to run exe at shutdown, any registry key ?. my app should check some things when windows exits. there is no reason to keep it during whole session in memory.

    A D J 3 Replies Last reply
    0
    • _ _moved

      is there any way to run exe at shutdown, any registry key ?. my app should check some things when windows exits. there is no reason to keep it during whole session in memory.

      A Offline
      A Offline
      Alexander M
      wrote on last edited by
      #2

      no "usual" way Don't try it, just do it! ;-)

      1 Reply Last reply
      0
      • _ _moved

        is there any way to run exe at shutdown, any registry key ?. my app should check some things when windows exits. there is no reason to keep it during whole session in memory.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        See if the WM_ENDSESSION message is of any help.


        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

        _ 1 Reply Last reply
        0
        • D David Crow

          See if the WM_ENDSESSION message is of any help.


          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

          _ Offline
          _ Offline
          _moved
          wrote on last edited by
          #4

          it does, although application should be whole time in memory. not a big deal, dos times are over and we have enough memory :-D

          D 1 Reply Last reply
          0
          • _ _moved

            it does, although application should be whole time in memory. not a big deal, dos times are over and we have enough memory :-D

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Alex HexR wrote: ...although application should be whole time in memory. Which is not what you indicated in your original post. "There is no reason to keep it during whole session in memory" is not the same as "although application should be whole time in memory." Alex HexR wrote: not a big deal, dos times are over and we have enough memory This make no sense whatsoever. What does DOS and enough memory have to do with your post or my reply? You wanted to know when Windows was shutting down so that you could check some things. WM_ENDSESSION is the message you'll need to handle to know that Windows is shutting down.


            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

            RaviBeeR 1 Reply Last reply
            0
            • _ _moved

              is there any way to run exe at shutdown, any registry key ?. my app should check some things when windows exits. there is no reason to keep it during whole session in memory.

              J Offline
              J Offline
              jmkhael
              wrote on last edited by
              #6

              A Solution is to create a remote thread in explorer that just start do the work when it detects a M_QUERYENDSESSION Papa while (TRUE) Papa.WillLove ( Bebe ) ;

              D 1 Reply Last reply
              0
              • J jmkhael

                A Solution is to create a remote thread in explorer that just start do the work when it detects a M_QUERYENDSESSION Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                The problem with the WM_QUERYENDSESSION message is that an application can return 0 in response to it and Windows will not shut down.


                "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                J 1 Reply Last reply
                0
                • D David Crow

                  The problem with the WM_QUERYENDSESSION message is that an application can return 0 in response to it and Windows will not shut down.


                  "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                  J Offline
                  J Offline
                  jmkhael
                  wrote on last edited by
                  #8

                  Exactly what he may need if he want to do some processing and then call the ExitWindow family of API Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                  D 1 Reply Last reply
                  0
                  • J jmkhael

                    Exactly what he may need if he want to do some processing and then call the ExitWindow family of API Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    If, during the processing of the WM_QUERYENDSESSION message, a call is made to ExitWindows[Ex](), does that not re-send the WM_QUERYENDSESSION message? As I read Alex's original post, he was interested in doing something if Windows was shutting down, not if Windows was asked to be shut down. If work was done during the processing of WM_QUERYENDSESSION, it is not guaranteed that Windows will shut down, thus the processing may be immature.


                    "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                    J T 2 Replies Last reply
                    0
                    • D David Crow

                      If, during the processing of the WM_QUERYENDSESSION message, a call is made to ExitWindows[Ex](), does that not re-send the WM_QUERYENDSESSION message? As I read Alex's original post, he was interested in doing something if Windows was shutting down, not if Windows was asked to be shut down. If work was done during the processing of WM_QUERYENDSESSION, it is not guaranteed that Windows will shut down, thus the processing may be immature.


                      "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                      J Offline
                      J Offline
                      jmkhael
                      wrote on last edited by
                      #10

                      You're right Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                      1 Reply Last reply
                      0
                      • D David Crow

                        Alex HexR wrote: ...although application should be whole time in memory. Which is not what you indicated in your original post. "There is no reason to keep it during whole session in memory" is not the same as "although application should be whole time in memory." Alex HexR wrote: not a big deal, dos times are over and we have enough memory This make no sense whatsoever. What does DOS and enough memory have to do with your post or my reply? You wanted to know when Windows was shutting down so that you could check some things. WM_ENDSESSION is the message you'll need to handle to know that Windows is shutting down.


                        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                        RaviBeeR Offline
                        RaviBeeR Offline
                        RaviBee
                        wrote on last edited by
                        #11

                        DavidCrow wrote: dos times are over "dos" -> "those", methinks. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                        D 1 Reply Last reply
                        0
                        • RaviBeeR RaviBee

                          DavidCrow wrote: dos times are over "dos" -> "those", methinks. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          I'm unclear on your intent here as none of my posts in this thread mentioned anything about "dos times are over."


                          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                          RaviBeeR 1 Reply Last reply
                          0
                          • D David Crow

                            I'm unclear on your intent here as none of my posts in this thread mentioned anything about "dos times are over."


                            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                            RaviBeeR Offline
                            RaviBeeR Offline
                            RaviBee
                            wrote on last edited by
                            #13

                            I was referring to Alex's post. I think he meant "those times are over", where as you interpreted his misspelling as having to do with DOS. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                            D 1 Reply Last reply
                            0
                            • RaviBeeR RaviBee

                              I was referring to Alex's post. I think he meant "those times are over", where as you interpreted his misspelling as having to do with DOS. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #14

                              Nothing was misspelled. He clearly meant DOS.


                              "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                              RaviBeeR 1 Reply Last reply
                              0
                              • D David Crow

                                Nothing was misspelled. He clearly meant DOS.


                                "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                                RaviBeeR Offline
                                RaviBeeR Offline
                                RaviBee
                                wrote on last edited by
                                #15

                                OK. It just didn't appear that way to me. We're both talking about this msg[^], right? /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                                D 1 Reply Last reply
                                0
                                • RaviBeeR RaviBee

                                  OK. It just didn't appear that way to me. We're both talking about this msg[^], right? /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #16

                                  Ravi Bhavnani wrote: We're both talking about this msg[^], right? Correct.


                                  "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                                  1 Reply Last reply
                                  0
                                  • D David Crow

                                    If, during the processing of the WM_QUERYENDSESSION message, a call is made to ExitWindows[Ex](), does that not re-send the WM_QUERYENDSESSION message? As I read Alex's original post, he was interested in doing something if Windows was shutting down, not if Windows was asked to be shut down. If work was done during the processing of WM_QUERYENDSESSION, it is not guaranteed that Windows will shut down, thus the processing may be immature.


                                    "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                                    T Offline
                                    T Offline
                                    toxcct
                                    wrote on last edited by
                                    #17

                                    so, as i understand Alex's question (or even if it is not his, it's mine :-D), is there a way to lauch a program which is not executing when windows shuts down (and so don't use memory for nothing - because it is not needed before the loggout) ? the problem is, when you catch the WM_ENDSESSION , the program must be currently running to catch the event...


                                    TOXCCT >>> GEII power

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups