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. my exe appears in task manager after closing.

my exe appears in task manager after closing.

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiohelp
5 Posts 4 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
    sunny_vc
    wrote on last edited by
    #1

    Hi all, I have a dialog based application in MFC using visual studio 2005. After I close the application, in CTestMainFrame::OnClose(), I am doing PostQuitMessage( 0); With this the dialog box closes but my application still exists in Windows task manager. Can you please help is there any other way I can kill my app completely.

    Regards, Sunil.

    J P E 3 Replies Last reply
    0
    • S sunny_vc

      Hi all, I have a dialog based application in MFC using visual studio 2005. After I close the application, in CTestMainFrame::OnClose(), I am doing PostQuitMessage( 0); With this the dialog box closes but my application still exists in Windows task manager. Can you please help is there any other way I can kill my app completely.

      Regards, Sunil.

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      To close a modal dialog (the main dialog of a dialog based application is a modal dialog), call one of the EndDialog(), OnOK(), or OnCancel() member functions of CDialog. This will perform all necessary cleanup, close the dialog and return to InitInstance() of your application. The application is then terminated by returning FALSE from InitInstance().

      1 Reply Last reply
      0
      • S sunny_vc

        Hi all, I have a dialog based application in MFC using visual studio 2005. After I close the application, in CTestMainFrame::OnClose(), I am doing PostQuitMessage( 0); With this the dialog box closes but my application still exists in Windows task manager. Can you please help is there any other way I can kill my app completely.

        Regards, Sunil.

        P Offline
        P Offline
        pasztorpisti
        wrote on last edited by
        #3

        Calling PostQuitMessage(0) should do the job but somewhere your application is buggy for sure, you have to check out all deinitialization code in your app. You put some buggy code to a destructor or a function called by mfc or by one of your own destructors during program shutdown that doesn't work as intended. Run the program in a debugger and if you can reproduce the bug in while debugging then try to check out what is goin on in your program by pressing the pause button in the debugger. Check out the callstack of all threads, especially that of the Main thread.

        E 1 Reply Last reply
        0
        • S sunny_vc

          Hi all, I have a dialog based application in MFC using visual studio 2005. After I close the application, in CTestMainFrame::OnClose(), I am doing PostQuitMessage( 0); With this the dialog box closes but my application still exists in Windows task manager. Can you please help is there any other way I can kill my app completely.

          Regards, Sunil.

          E Offline
          E Offline
          Erudite_Eric
          wrote on last edited by
          #4

          Why did you replace CDialog::OnClose(); given you by the wizzard with PostQuitMessage()? You HAVE to allow the base class to function correctly.

          1 Reply Last reply
          0
          • P pasztorpisti

            Calling PostQuitMessage(0) should do the job but somewhere your application is buggy for sure, you have to check out all deinitialization code in your app. You put some buggy code to a destructor or a function called by mfc or by one of your own destructors during program shutdown that doesn't work as intended. Run the program in a debugger and if you can reproduce the bug in while debugging then try to check out what is goin on in your program by pressing the pause button in the debugger. Check out the callstack of all threads, especially that of the Main thread.

            E Offline
            E Offline
            Erudite_Eric
            wrote on last edited by
            #5

            Dont liaten to this guy, he is an idiot. Calling PostQuitMessage from you OnClose handler is goin to do what?

            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