Shuting down, killing services and WM_DESTROY

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drexlin
    New Member
    • Apr 2007
    • 8

    Shuting down, killing services and WM_DESTROY

    We have an application that is supposed to run as a service. When someone shuts down the computer, the app is supposed to save the contents of the screen into a file so it can be loaded back up when the computer comes back on.

    So my question is, does shuting down the computer send a WM_DESTROY message to the program if it is being run as a service? If not, why not?

    Thanks!
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Originally posted by drexlin
    We have an application that is supposed to run as a service. When someone shuts down the computer, the app is supposed to save the contents of the screen into a file so it can be loaded back up when the computer comes back on.

    So my question is, does shuting down the computer send a WM_DESTROY message to the program if it is being run as a service? If not, why not?

    Thanks!
    I think all applications are asked by the OS to close when the computer is shutting down. So that means that the application would get the same messages as if a user had clicked on the little X button.

    Comment

    • drexlin
      New Member
      • Apr 2007
      • 8

      #3
      Well, we've tested it, and if we close the app via the X, then the message gets sent as it should. But if we shut the computer down while the service is still running, then it doesn't get sent.

      Any thoughts?

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by drexlin
        Well, we've tested it, and if we close the app via the X, then the message gets sent as it should. But if we shut the computer down while the service is still running, then it doesn't get sent.

        Any thoughts?
        Subscribe to power management events?

        Comment

        • drexlin
          New Member
          • Apr 2007
          • 8

          #5
          Well, that's part of my question. What messages get sent to the app if the power button is hit? Does WM_POWERBROADCA ST get sent?

          Comment

          • RedSon
            Recognized Expert Expert
            • Jan 2007
            • 4980

            #6
            Originally posted by drexlin
            Well, that's part of my question. What messages get sent to the app if the power button is hit? Does WM_POWERBROADCA ST get sent?
            On mobile devices it does. I would think that the XP powermanager would be more advanced the mobile devices, so you probably want to read up on MSDN for that message.

            Comment

            Working...