User defined message , exception at handler's return
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: User defined message , exception at handler's return

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    17

    User defined message , exception at handler's return

    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:
    Code:
               .
               .	
    	afx_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
               .
               .
    Parent dialog header, Declared Mesagge map:
    Code:
               .
               .
    	afx_msg void OnMsjGuardarConfig();
               .
               .
    Parent dialog source, file Message map:
    Code:
               .
               .
    	ON_MESSAGE(WM_MsjGuardarConfig, OnMsjGuardarConfig)
               .
               .
    Parent dialog source, file definition of the handler:

    Code:
    LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
    {
      //i do some stuffs 
    return 0; // ==> here is exception !!!!
    }
    Defining the user defined message in StdAfx.h:
    Code:
               .
               .
    #define WM_MsjGuardarConfig WM_USER+1 // 
               .
               .
    Posting the message in the child dialog:
    Code:
    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!!

  2. #2
    Join Date
    Jul 2010
    Posts
    88

    Re: User defined message , exception at handler's return

    If you capture the errors, you can use return values back to the caller.

    There should not be too much difference from this newer version of VC++.
    http://msdn.microsoft.com/en-us/libr...=VS.80%29.aspx

  3. #3
    Join Date
    Oct 2009
    Posts
    17

    Added Info: User defined message , exception at handler's return

    Ok thanks for your answer, I'm going to check that.
    However I'd like to add some extra info:
    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.

    When the exception comes up, i have this debug log:
    Code:
    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 :
    Code:
    5F430BE2   call        dword ptr [eax+98h] // jump to this line.
    5F430BE8   test        eax,eax
    5F430BEA   je          5F430BF3
    5F430BEC   mov         eax,1
    5F430BF1   jmp         5F430C01
    5F430BF3   mov         ecx,dword ptr [ebp-4]
    5F430BF6   cmp         ecx,dword ptr [ebp+8]
    5F430BF9   jne         5F430BFD
    5F430BFB   jmp         5F430BFF
    5F430BFD   jmp         5F430BB1
    5F430BFF   xor         eax,eax
    .
    .

  4. #4
    Join Date
    Apr 1999
    Posts
    27,446

    Re: User defined message , exception at handler's return

    Quote Originally Posted by Timbk View Post
    //i do some stuffs
    .
    What is this "stuff" that you're doing? You should post everything that you're doing, and not take lines of code for granted. You could be doing something wrong in the code you're not showing us, causing problems later on.

    Also, recompile your entire project, to make sure it isn't a build problem that's causing the issue.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; December 10th, 2010 at 04:14 PM.

  5. #5
    Join Date
    Oct 2009
    Posts
    17

    Re: User defined message , exception at handler's return

    Thanks, all code is comented in this handler so now look like this:
    Code:
    LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
    {
        return 0;
    }
    thats way I put "// do some stuffs.

    And ies, I'm already rebuilt the entire projet, but, the ecxeption is still there.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center