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. User defined message , exeption at the handler return [modified]

User defined message , exeption at the handler return [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
11 Posts 6 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 timbk

    Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs). And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation Parent dialog header, declaration of Handler:

           .
           .	
    afx\_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
           .
           .
    

    Parent dialog header, Declared Mesagge map:

           .
           .
    afx\_msg void OnMsjGuardarConfig();
           .
           .
    

    Parent dialog source, file Message map:

           .
           .
    ON\_MESSAGE(WM\_MsjGuardarConfig, OnMsjGuardarConfig)
           .
           .
    

    Parent dialog source, file definition of the handler:

    LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
    {
    //i do some stuffs
    return 0; // ==> here is exception !!!!
    }

    Defining the user defined message in StdAfx.h:

           .
           .
    

    #define WM_MsjGuardarConfig WM_USER+1 //
    .
    .

    Posting the message in the child dialog:

    void CConfiguracionDlg::OnBUTTONGuadar()
    {
    GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL); //
    }

    Probably is some newbie problem , but i can't fix it until now. :( Thanks in advance!!

    modified on Friday, December 10, 2010 10:25 AM

    C Offline
    C Offline
    Cool_Dev
    wrote on last edited by
    #2

    timbk wrote:

    //i do some stuffs

    what are the stuffs you do there?

    timbk wrote:

    afx_msg void OnMsjGuardarConfig();

    what is this meant for, though it may not be the reason for your problem.?

    T 1 Reply Last reply
    0
    • T timbk

      Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs). And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation Parent dialog header, declaration of Handler:

             .
             .	
      afx\_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
             .
             .
      

      Parent dialog header, Declared Mesagge map:

             .
             .
      afx\_msg void OnMsjGuardarConfig();
             .
             .
      

      Parent dialog source, file Message map:

             .
             .
      ON\_MESSAGE(WM\_MsjGuardarConfig, OnMsjGuardarConfig)
             .
             .
      

      Parent dialog source, file definition of the handler:

      LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
      {
      //i do some stuffs
      return 0; // ==> here is exception !!!!
      }

      Defining the user defined message in StdAfx.h:

             .
             .
      

      #define WM_MsjGuardarConfig WM_USER+1 //
      .
      .

      Posting the message in the child dialog:

      void CConfiguracionDlg::OnBUTTONGuadar()
      {
      GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL); //
      }

      Probably is some newbie problem , but i can't fix it until now. :( Thanks in advance!!

      modified on Friday, December 10, 2010 10:25 AM

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #3

      timbk wrote:

      afx_msg void OnMsjGuardarConfig();

      shouldn't that be :

      LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);

      Watched code never compiles.

      T 1 Reply Last reply
      0
      • C Cool_Dev

        timbk wrote:

        //i do some stuffs

        what are the stuffs you do there?

        timbk wrote:

        afx_msg void OnMsjGuardarConfig();

        what is this meant for, though it may not be the reason for your problem.?

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

        Cool_Dev wrote:

        timbk wrote: //i do some stuffs what are the stuffs you do there?

        At the moment nothing , all code inside es comented, so this is how it looks now:

        LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
        {
        return 0; // ==> here is the exception !!
        }

        Cool_Dev wrote:

        timbk wrote: afx_msg void OnMsjGuardarConfig(); what is this meant for, though it may not be the reason for your problem.?

        I'm not sure to understand very weel this question, but anyway , this piece of code that you quote is in the header file of parent dialog let say's MydialogDlg.h :

                .
                .
        

        protected:
        HICON m_hIcon;

        // Generated message map functions
        //{{AFX\_MSG(CCalibracionDlg)
                .
                .           
        afx\_msg void OnSetfocusEditSens7();
        afx\_msg void OnSetfocusEditSens8();
        afx\_msg void OnConfiguracion();
        afx\_msg void OnMsjGuardarConfig();
                .
                .
            //}}AFX\_MSG
        DECLARE\_MESSAGE\_MAP()
        
        1 Reply Last reply
        0
        • M Maximilien

          timbk wrote:

          afx_msg void OnMsjGuardarConfig();

          shouldn't that be :

          LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);

          Watched code never compiles.

          T Offline
          T Offline
          timbk
          wrote on last edited by
          #5

          Maximilien wrote:

          timbk wrote: afx_msg void OnMsjGuardarConfig(); shouldn't that be : LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);

          Ok , I tried with this:

          LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);

          instead of

          afx_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);

          and besides :

          afx_msg void OnMsjGuardarConfig();

          instead of

          afx_msg void OnMsjGuardarConfig();

          Is this what you meant? No erros compiling, but I get the same exception.

          1 Reply Last reply
          0
          • T timbk

            Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs). And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation Parent dialog header, declaration of Handler:

                   .
                   .	
            afx\_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
                   .
                   .
            

            Parent dialog header, Declared Mesagge map:

                   .
                   .
            afx\_msg void OnMsjGuardarConfig();
                   .
                   .
            

            Parent dialog source, file Message map:

                   .
                   .
            ON\_MESSAGE(WM\_MsjGuardarConfig, OnMsjGuardarConfig)
                   .
                   .
            

            Parent dialog source, file definition of the handler:

            LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
            {
            //i do some stuffs
            return 0; // ==> here is exception !!!!
            }

            Defining the user defined message in StdAfx.h:

                   .
                   .
            

            #define WM_MsjGuardarConfig WM_USER+1 //
            .
            .

            Posting the message in the child dialog:

            void CConfiguracionDlg::OnBUTTONGuadar()
            {
            GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL); //
            }

            Probably is some newbie problem , but i can't fix it until now. :( Thanks in advance!!

            modified on Friday, December 10, 2010 10:25 AM

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #6

            Use WM_APP + 1 instead of WM_USER + 1.

            «_Superman_»  _I love work. It gives me something to do between weekends.

            _Microsoft MVP (Visual C++)

            Polymorphism in C

            T 1 Reply Last reply
            0
            • _ _Superman_

              Use WM_APP + 1 instead of WM_USER + 1.

              «_Superman_»  _I love work. It gives me something to do between weekends.

              _Microsoft MVP (Visual C++)

              Polymorphism in C

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

              «_Superman_» wrote:

              Use WM_APP + 1 instead of WM_USER + 1.

              Thanks for your answer, I did what you said, but i get the same exception.

              1 Reply Last reply
              0
              • T timbk

                Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs). And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation Parent dialog header, declaration of Handler:

                       .
                       .	
                afx\_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
                       .
                       .
                

                Parent dialog header, Declared Mesagge map:

                       .
                       .
                afx\_msg void OnMsjGuardarConfig();
                       .
                       .
                

                Parent dialog source, file Message map:

                       .
                       .
                ON\_MESSAGE(WM\_MsjGuardarConfig, OnMsjGuardarConfig)
                       .
                       .
                

                Parent dialog source, file definition of the handler:

                LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
                {
                //i do some stuffs
                return 0; // ==> here is exception !!!!
                }

                Defining the user defined message in StdAfx.h:

                       .
                       .
                

                #define WM_MsjGuardarConfig WM_USER+1 //
                .
                .

                Posting the message in the child dialog:

                void CConfiguracionDlg::OnBUTTONGuadar()
                {
                GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL); //
                }

                Probably is some newbie problem , but i can't fix it until now. :( Thanks in advance!!

                modified on Friday, December 10, 2010 10:25 AM

                T Offline
                T Offline
                timbk
                wrote on last edited by
                #8

                When the exception comes up, i have this debug log:

                Loaded 'ntdll.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\inpout32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\MFC42D.DLL', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\MSVCRTD.DLL', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
                Loaded symbols for 'C:\WINDOWS\system32\MFCO42D.DLL'
                Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\mfc42loc.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
                Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
                Loaded 'C:\Archivos de programa\Internet Download Manager\idmmkb.dll', no matching symbolic information found.
                Warning: dialog data checkbox value (2117840950) out of range. //I can't find why , all checkboxes seems ok.
                Warning: dialog data checkbox value (1598735280) out of range. //I can't find why , all checkboxes seems ok
                First-chance exception in Calibracion.exe (MFC42D.DLL): 0xC0000005: Access Violation.

                Look at the warnings about checkboxes , there were a lot more , but once i saved the file generated by Myapp, all these checkboxes warnings desappeared , but these two not, i can't find them. Another thing , when the exception comes up the debugger jumps to a asembler code :

                5F430BE2 call dword ptr [eax+98h] // jump to this line.
                5F430BE8 test eax,eax
                5F4

                1 Reply Last reply
                0
                • T timbk

                  Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs). And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation Parent dialog header, declaration of Handler:

                         .
                         .	
                  afx\_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
                         .
                         .
                  

                  Parent dialog header, Declared Mesagge map:

                         .
                         .
                  afx\_msg void OnMsjGuardarConfig();
                         .
                         .
                  

                  Parent dialog source, file Message map:

                         .
                         .
                  ON\_MESSAGE(WM\_MsjGuardarConfig, OnMsjGuardarConfig)
                         .
                         .
                  

                  Parent dialog source, file definition of the handler:

                  LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
                  {
                  //i do some stuffs
                  return 0; // ==> here is exception !!!!
                  }

                  Defining the user defined message in StdAfx.h:

                         .
                         .
                  

                  #define WM_MsjGuardarConfig WM_USER+1 //
                  .
                  .

                  Posting the message in the child dialog:

                  void CConfiguracionDlg::OnBUTTONGuadar()
                  {
                  GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL); //
                  }

                  Probably is some newbie problem , but i can't fix it until now. :( Thanks in advance!!

                  modified on Friday, December 10, 2010 10:25 AM

                  T Offline
                  T Offline
                  timbk
                  wrote on last edited by
                  #9

                  The ecxeption is a first chance exception :First-chance exception in MyApp.exe (MFC42D.DLL): 0xC0000005: Access Violation. The app runs without any exception, but after the PostMessage is sent to the parent dialog , the child dialog do some things wrong , dones't work fine, but there isn't any errors messages.

                  L 1 Reply Last reply
                  0
                  • T timbk

                    The ecxeption is a first chance exception :First-chance exception in MyApp.exe (MFC42D.DLL): 0xC0000005: Access Violation. The app runs without any exception, but after the PostMessage is sent to the parent dialog , the child dialog do some things wrong , dones't work fine, but there isn't any errors messages.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    You have some conflicting statements here, you cannot say the app works without exception when an exception has occurred. You also say "the child dialog do some things wrong". So, find out why it is doing those things and fix the program. You need to spend time with your debugger finding out why the exception occurs, and why the other errors happen. From the information you have provided it is impossible to guess what your code is doing.

                    Just say 'NO' to evaluated arguments for diadic functions! Ash

                    1 Reply Last reply
                    0
                    • T timbk

                      Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs). And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation Parent dialog header, declaration of Handler:

                             .
                             .	
                      afx\_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
                             .
                             .
                      

                      Parent dialog header, Declared Mesagge map:

                             .
                             .
                      afx\_msg void OnMsjGuardarConfig();
                             .
                             .
                      

                      Parent dialog source, file Message map:

                             .
                             .
                      ON\_MESSAGE(WM\_MsjGuardarConfig, OnMsjGuardarConfig)
                             .
                             .
                      

                      Parent dialog source, file definition of the handler:

                      LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
                      {
                      //i do some stuffs
                      return 0; // ==> here is exception !!!!
                      }

                      Defining the user defined message in StdAfx.h:

                             .
                             .
                      

                      #define WM_MsjGuardarConfig WM_USER+1 //
                      .
                      .

                      Posting the message in the child dialog:

                      void CConfiguracionDlg::OnBUTTONGuadar()
                      {
                      GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL); //
                      }

                      Probably is some newbie problem , but i can't fix it until now. :( Thanks in advance!!

                      modified on Friday, December 10, 2010 10:25 AM

                      G Offline
                      G Offline
                      Gary R Wheeler
                      wrote on last edited by
                      #11

                      I would bet your routine is overwriting part of the stack. When it reaches the return statement, the return address has been clobbered, and BOOM.

                      Software Zen: delete this;
                      Fold With Us![^]

                      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