Click to See Complete Forum and Search --> : SendMessage problems


April 20th, 1999, 05:06 AM
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

Nath
April 21st, 1999, 02:15 PM
And when U uses PostMessage instead of SendMessage... Because your dialog is Modal ??

Nath.

Eran Kariti
April 21st, 1999, 02:40 PM
your function have to be
OnFunc(WPARAM wParam, LPARAM lParam)

sally
April 21st, 1999, 09:26 PM
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

Sally
April 21st, 1999, 09:26 PM
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