Click to See Complete Forum and Search --> : Richedit woes


hixxy
March 18th, 2006, 09:03 AM
I'm trying to catch edit and selchange events in a richedit. The problem is, the parent window never receives WM_NOTIFY messages from the richedit even though I do SendMessage( this->m_Hwnd, EM_SETEVENTMASK, 0, ENM_CHANGE|ENM_SELCHANGE ); after creation.

Instead, the richedit sends "1024" as HIWORD( wParam ) in a WM_COMMAND message and EN_CHANGE is never sent at all. Does anybody know what I'm doing wrong?

Brenton S.
March 18th, 2006, 12:42 PM
Could you post a code snippet? I don't understand the problem.

hixxy
March 18th, 2006, 01:35 PM
Sure, but it's part of a huge wrapper with a lot of code that's irrelevant to this question, so I can't post all of the relevant code in one piece.

Straight after setting the richedit's Window Procedure (this->m_Hwnd = richedit hwnd):

SendMessage( this->m_Hwnd, EM_SETEVENTMASK, 0, ENM_CHANGE | ENM_DROPFILES | ENM_SELCHANGE );

In the WM_NOTIFY part of the parent's Window Procedure (ClassName is the class retrieved from GetClassName() on hdr->hwndFrom, hdr is defined as LPNMHDR hdr = (LPNMHDR) lParam):

case EN_CHANGE:
{
if ( lstrcmpi( "EDIT", ClassName ) == 0 )
return SendMessage( hdr->hwndFrom, uMsg, wParam, lParam );
else if ( lstrcmp( DCX_RICHEDITCLASS, ClassName ) == 0 )
return SendMessage( hdr->hwndFrom, uMsg, wParam, lParam );
}
break;

The above never triggers, this is the problem.

In the richedit Window Procedure (mIRCError() is just a function for sending debug or error messages to the application this dll is for):

case WM_NOTIFY:
{
mIRCError( "WM_NOTIFY - Richedit" );
}
break;

Brenton S.
March 18th, 2006, 06:12 PM
I'm not sure what the problem is. It seems like it should work. Can you possible email me the code via the Members List?

hixxy
March 18th, 2006, 09:22 PM
I'll have to ask. It's part of a project that I've taken over, but I will still respect the author's wishes if he doesn't want the source code released yet.