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 can i close my SDI Applcation?

How can i close my SDI Applcation?

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 Posts 7 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.
  • R RonnyS

    Hello! I have tried to Close my SDI Apllication with Destroy(); or with OnClose(); but it didnt works! Does somebody know what function i have to use? Thanks a lot! Ronny

    B Offline
    B Offline
    bneacetp
    wrote on last edited by
    #2

    Try CMainFrame's PostMessage(WM_CLOSE) Happy Programming and God Bless! Internet::WWW::CodeProject::bneacetp

    R 1 Reply Last reply
    0
    • B bneacetp

      Try CMainFrame's PostMessage(WM_CLOSE) Happy Programming and God Bless! Internet::WWW::CodeProject::bneacetp

      R Offline
      R Offline
      RonnyS
      wrote on last edited by
      #3

      Hello ant thanks!! But it didnt works, is there another way to close the App?

      V 1 Reply Last reply
      0
      • R RonnyS

        Hello ant thanks!! But it didnt works, is there another way to close the App?

        V Offline
        V Offline
        vcplusplus
        wrote on last edited by
        #4

        You might need to process the WM_CLOSE message. void CMainFrame::OnClose() { CFrameWnd::OnClose(); return; }

        R 1 Reply Last reply
        0
        • V vcplusplus

          You might need to process the WM_CLOSE message. void CMainFrame::OnClose() { CFrameWnd::OnClose(); return; }

          R Offline
          R Offline
          RonnyS
          wrote on last edited by
          #5

          Thanks that was a good idea, but i have forgotten to tell i need a function wich i can start in the View Class. I have tried to make a public function in Mainframe and use it in the View Class and it was complile able but it also didnt works...

          T V 2 Replies Last reply
          0
          • R RonnyS

            Hello! I have tried to Close my SDI Apllication with Destroy(); or with OnClose(); but it didnt works! Does somebody know what function i have to use? Thanks a lot! Ronny

            G Offline
            G Offline
            gamitech
            wrote on last edited by
            #6

            probably the most accurate closing of app is this HANDLE handle DWORD lpExitCode; handle=GetCurrentProcess(); GetExitCodeProcess(handle,&lpExitCode); TerminateProcess(handle,lpExitCode); Clean Exit right ? gabby

            1 Reply Last reply
            0
            • R RonnyS

              Thanks that was a good idea, but i have forgotten to tell i need a function wich i can start in the View Class. I have tried to make a public function in Mainframe and use it in the View Class and it was complile able but it also didnt works...

              T Offline
              T Offline
              testtests
              wrote on last edited by
              #7

              Try this: CWnd *pWnd; pWnd = CWnd::FindWindow(NULL, _T("MyWindowsName")); pWnd->SendMessage(WM_CLOSE); Let me know if it works. Regards, Testtests

              1 Reply Last reply
              0
              • R RonnyS

                Hello! I have tried to Close my SDI Apllication with Destroy(); or with OnClose(); but it didnt works! Does somebody know what function i have to use? Thanks a lot! Ronny

                I Offline
                I Offline
                ImtiazQureshi
                wrote on last edited by
                #8

                try using AfxGetMainWnd()->PostQuitMessage(0); :) good luck Imtiaz Qureshi

                1 Reply Last reply
                0
                • R RonnyS

                  Thanks that was a good idea, but i have forgotten to tell i need a function wich i can start in the View Class. I have tried to make a public function in Mainframe and use it in the View Class and it was complile able but it also didnt works...

                  V Offline
                  V Offline
                  vcplusplus
                  wrote on last edited by
                  #9

                  From CView: AfxGetMainWnd()->SendMessage(WM_CLOSE); or AfxGetMainWnd()->PostMessage(WM_CLOSE);

                  1 Reply Last reply
                  0
                  • R RonnyS

                    Hello! I have tried to Close my SDI Apllication with Destroy(); or with OnClose(); but it didnt works! Does somebody know what function i have to use? Thanks a lot! Ronny

                    J Offline
                    J Offline
                    John R Shaw
                    wrote on last edited by
                    #10

                    AfxGetApp()->GetMainWnd()->PostMessage(WM_CLOSE); INTP

                    R 1 Reply Last reply
                    0
                    • J John R Shaw

                      AfxGetApp()->GetMainWnd()->PostMessage(WM_CLOSE); INTP

                      R Offline
                      R Offline
                      RonnyS
                      wrote on last edited by
                      #11

                      THANKS TO ALL!!! Thank you very very very much!! (Sorry for my late Answer!!!) It works great!! Thanks!! Ronny

                      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