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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. "Ending program ... please wait" - what system message needs a response ?

"Ending program ... please wait" - what system message needs a response ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 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.
  • S Offline
    S Offline
    Still learning how to code
    wrote on last edited by
    #1

    I have a home-made app which performs fine, until the system is rebooted/restarted. Then I get the message "Ending program ... please wait", a timeout occurs, and then the app ends. As this is the only app which responds in this way, I assume that I have not coded the response to a system message which is causing the timeout. What system message is being sent and what response should be made to cause immediate termination ? Thanks in advance ! Doug

    C L 2 Replies Last reply
    0
    • S Still learning how to code

      I have a home-made app which performs fine, until the system is rebooted/restarted. Then I get the message "Ending program ... please wait", a timeout occurs, and then the app ends. As this is the only app which responds in this way, I assume that I have not coded the response to a system message which is causing the timeout. What system message is being sent and what response should be made to cause immediate termination ? Thanks in advance ! Doug

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Not completely sure but maybe what you need is WM_QUERYENDSESSION[^] or WM_ENDSESSION[^]? This[^] here might also be useful to read.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<

      1 Reply Last reply
      0
      • S Still learning how to code

        I have a home-made app which performs fine, until the system is rebooted/restarted. Then I get the message "Ending program ... please wait", a timeout occurs, and then the app ends. As this is the only app which responds in this way, I assume that I have not coded the response to a system message which is causing the timeout. What system message is being sent and what response should be made to cause immediate termination ? Thanks in advance ! Doug

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        AFAIK a Windows app will get terminated automatically if it is a WinForms app (hence a message pump is active) with proper event handling (always responsive, so no long-winding event handlers), AND no extra threads are running in the foreground. If you need background activity, I recommend you mark your threads background ones, so they don't prevent app shutdown. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        S 1 Reply Last reply
        0
        • L Luc Pattyn

          AFAIK a Windows app will get terminated automatically if it is a WinForms app (hence a message pump is active) with proper event handling (always responsive, so no long-winding event handlers), AND no extra threads are running in the foreground. If you need background activity, I recommend you mark your threads background ones, so they don't prevent app shutdown. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          S Offline
          S Offline
          Still learning how to code
          wrote on last edited by
          #4

          Found the "problem" ! (Embarresing really !) I wrote this app a long time ago and used a dialog-based MFC app but prevented the dialog appearing so that it effectively ran in the background. The main "routine" was in InitDialog() and effectively prevented messages being handled by the "window". Now create a thread in InitDialog(), let it complete, and hide the window in another way. WM_QUERYENDSESSION is now handled, and all works fine ! Thanks for your thought-provoking comments !! :) Doug

          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