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. PostMessage(WM_QUIT);

PostMessage(WM_QUIT);

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++html
7 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.
  • T Offline
    T Offline
    Tara14
    wrote on last edited by
    #1

    Hi, I have an MFC (VC6) app that uses a splitter window. There are buttons on the left and info is displayed on the right. I have added a "Quit" button to the left splitter with the following code"

    void CControlPanel::OnBtnQuit()
    {
    PostMessage(WM_QUIT);
    }

    And some clean up operation is done in CResidentialEstimatorApp::ExitInstance()

    int CResidentialEstimatorApp::ExitInstance()
    {

        CString file;
    file = GetPath("tempEst","html");
    CleanUPm(file);
    
    return CWinApp::ExitInstance();
    

    }

    The program crashes sometimes when the 'Quit' button is clicked. I can't figure out why this is happening. If the program is closed using the 'X' button or File-Exit from the menu, there is no problem. Any help is highly appreciated! Thanks, Tara

    _


    Fortitudine Vincimus!_

    N F 2 Replies Last reply
    0
    • T Tara14

      Hi, I have an MFC (VC6) app that uses a splitter window. There are buttons on the left and info is displayed on the right. I have added a "Quit" button to the left splitter with the following code"

      void CControlPanel::OnBtnQuit()
      {
      PostMessage(WM_QUIT);
      }

      And some clean up operation is done in CResidentialEstimatorApp::ExitInstance()

      int CResidentialEstimatorApp::ExitInstance()
      {

          CString file;
      file = GetPath("tempEst","html");
      CleanUPm(file);
      
      return CWinApp::ExitInstance();
      

      }

      The program crashes sometimes when the 'Quit' button is clicked. I can't figure out why this is happening. If the program is closed using the 'X' button or File-Exit from the menu, there is no problem. Any help is highly appreciated! Thanks, Tara

      _


      Fortitudine Vincimus!_

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      Have you tried this? AfxGetMainWnd()->PostMessage( WM_QUIT );

      - NS - [ODBaseBtn]

      T 1 Reply Last reply
      0
      • T Tara14

        Hi, I have an MFC (VC6) app that uses a splitter window. There are buttons on the left and info is displayed on the right. I have added a "Quit" button to the left splitter with the following code"

        void CControlPanel::OnBtnQuit()
        {
        PostMessage(WM_QUIT);
        }

        And some clean up operation is done in CResidentialEstimatorApp::ExitInstance()

        int CResidentialEstimatorApp::ExitInstance()
        {

            CString file;
        file = GetPath("tempEst","html");
        CleanUPm(file);
        
        return CWinApp::ExitInstance();
        

        }

        The program crashes sometimes when the 'Quit' button is clicked. I can't figure out why this is happening. If the program is closed using the 'X' button or File-Exit from the menu, there is no problem. Any help is highly appreciated! Thanks, Tara

        _


        Fortitudine Vincimus!_

        F Offline
        F Offline
        followait
        wrote on last edited by
        #3

        use

        VOID PostQuitMessage(
        int nExitCode // exit code
        );

        1 Reply Last reply
        0
        • N Nishad S

          Have you tried this? AfxGetMainWnd()->PostMessage( WM_QUIT );

          - NS - [ODBaseBtn]

          T Offline
          T Offline
          Tara14
          wrote on last edited by
          #4

          Thanks. I have tried as you suggested. But the program still crashes. For some reason, it is happening on some XP systems. It doesn't happen on my computer. Also if the 'X' button is clicked or File-Exit is clicked there is no problem. I just don't understand why this is happening.

          _


          Fortitudine Vincimus!_

          N 1 Reply Last reply
          0
          • T Tara14

            Thanks. I have tried as you suggested. But the program still crashes. For some reason, it is happening on some XP systems. It doesn't happen on my computer. Also if the 'X' button is clicked or File-Exit is clicked there is no problem. I just don't understand why this is happening.

            _


            Fortitudine Vincimus!_

            N Offline
            N Offline
            Nishad S
            wrote on last edited by
            #5

            Debugging the application may help you? If we got a "Abort Retry Ignore" message box when it crashes, then we can locate the code part.

            - NS - [ODBaseBtn]

            T 1 Reply Last reply
            0
            • N Nishad S

              Debugging the application may help you? If we got a "Abort Retry Ignore" message box when it crashes, then we can locate the code part.

              - NS - [ODBaseBtn]

              T Offline
              T Offline
              Tara14
              wrote on last edited by
              #6

              It turned out that the computers on which this was happening, after re-installing MS Office, the problem disappeared. I wonder why. Would you be having any idea? The program only uses the IE browser to display reports; nothing else that would clash with MS Office.:confused:

              _


              Fortitudine Vincimus!_

              N 1 Reply Last reply
              0
              • T Tara14

                It turned out that the computers on which this was happening, after re-installing MS Office, the problem disappeared. I wonder why. Would you be having any idea? The program only uses the IE browser to display reports; nothing else that would clash with MS Office.:confused:

                _


                Fortitudine Vincimus!_

                N Offline
                N Offline
                Nishad S
                wrote on last edited by
                #7

                :confused: :(

                - NS - [ODBaseBtn]

                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