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. How to exit an application by hitting an exit button

How to exit an application by hitting an exit button

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasehelptutorial
4 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.
  • J Offline
    J Offline
    joy007
    wrote on last edited by
    #1

    I 've created a single document database application in VC++.The problem is that I can not make out how to make an "exit" button which when hit will close the application immediately(i.e,MainFrame will be closed).

    T M 2 Replies Last reply
    0
    • J joy007

      I 've created a single document database application in VC++.The problem is that I can not make out how to make an "exit" button which when hit will close the application immediately(i.e,MainFrame will be closed).

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      use this api PostQuitMessage(0); or this->SendMessage(WM_CLOSE,0,0);


      "I Think this Will Help"

      visit me at http://www.thisisalok.tk
      Mircea PuiuM 1 Reply Last reply
      0
      • T ThatsAlok

        use this api PostQuitMessage(0); or this->SendMessage(WM_CLOSE,0,0);


        "I Think this Will Help"

        visit me at http://www.thisisalok.tk
        Mircea PuiuM Offline
        Mircea PuiuM Offline
        Mircea Puiu
        wrote on last edited by
        #3

        ...or.... exit(0) SkyWalker

        1 Reply Last reply
        0
        • J joy007

          I 've created a single document database application in VC++.The problem is that I can not make out how to make an "exit" button which when hit will close the application immediately(i.e,MainFrame will be closed).

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          AfxGetMainWnd()-> PostMessage ( WM_CLOSE ) That will gracefully exit the app just as if you clicked the [X] button in the window caption. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb Strange things are afoot at the U+004B U+20DD

          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