CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Guest

    SendMessage problems

    Hi Gurus !

    I have a problem with SendMessage().

    In a modal dialog I make this call:

    ...
    m_pParent->SendMessage( WM_UPDATE_DATA, m_sData );
    ...




    'm_pParent' is a valid pointer to 'CMyMainFrm' class and the handler for the message 'WM_UPDATE_DATA' is placed in there.

    Now the problem:
    All works fine, if my code is compiled in debug mode. But if I compile it in release mode it breaks.
    What happens is:
    The message handler process the message correct.

    But than the program breaks with this message:
    "Unhandled exception in Myapp.exe(MFC42.DLL):0xC00000005: Access Violation."
    and the debugger jumps to following code into the file 'mfc\src\Map_pp.cpp':


    void* CMapPtrToPtr::GetValueAt(void* key) const
    // find value (or return NULL -- NULL values not different as a result)
    {
    ...
    }




    Why does my code work in debug mode but not in release mode.
    What should I do to compile my code correct ??


    Thanks for reading

    Bye Joerg


  2. #2
    Join Date
    Apr 1999
    Location
    Quebec, Canada
    Posts
    39

    Re: SendMessage problems

    And when U uses PostMessage instead of SendMessage... Because your dialog is Modal ??

    Nath.


  3. #3
    Join Date
    Apr 1999
    Posts
    7

    Re: SendMessage problems

    your function have to be
    OnFunc(WPARAM wParam, LPARAM lParam)


  4. #4
    Join Date
    May 1999
    Location
    Sydney, Australia
    Posts
    420

    Re: SendMessage problems

    Even if you just use the WPARAM parameter, both WPARA and LPARAM are used by the system. LPARAM in this case defaults to zero, so your function prototype NEED to be declared with BOTH WPARAM and LPARAM. Are they?

    sally


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured