-
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
-
Re: SendMessage problems
And when U uses PostMessage instead of SendMessage... Because your dialog is Modal ??
Nath.
-
Re: SendMessage problems
your function have to be
OnFunc(WPARAM wParam, LPARAM lParam)
-
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