Hi all,

I want to be able to check and respond to user editing of a RichEdit control (adding a character, cut, paste, delete).

The first thing that I tried was setting the edit control text to protected and processing the EN_PROTECTED message...this worked fine for receiving WM_CHAR, WM_CUT, and WM_PASTE messages, but I never received any messages for delete or backspace. According to what I've read in Icz's tutes and the Win32 help file, I should be able to receive the WM_CLEAR message for these, but I don't.

Next I tried subclassing the RichEdit window...I was able to check the same as before plus the backspace through WM_CHAR, but I still never received WM_CLEAR. Is there another windows message that I don't know about that I could be missing?

Here is my subclassed function. The RichEdit control(s) that I'm interested in checking are children of MDI child windows, so I thought it best to store the old window proc in GWL_USERDATA of the RichEdit window...maybe I don't need to do this - do all RichEdit windows have the same procedure address? (If so, I could just store the proc address in a global var. instead of storing each one separately)

PreEditProc PROC USES esi edi ebx hWnd :DWORD,uMsg :DWORD,wParam :DWORD,lParam :DWORD

mov lpOldProc,eax

.IF uMsg == WM_CHAR

INVOKE CallWindowProc, lpOldProc, hWnd, uMsg, wParam, lParam
PreEditProc ENDP
Posted on 2003-07-18 19:38:59 by sirchess2

I guess with subclassing I receive the cut, paste, and even copy messages as WM_CHAR. Probably wouldn't be too difficult to figure out which is which though.

My main concern is with the delete key, though...I need a way to tell when it's being sent to the RichEdit control.
Posted on 2003-07-18 19:50:56 by sirchess2
I did some more reading...apparently TranslateMessage doesn't post WM_CHAR messages for the "function and arrow keys" :mad:

Which means, I guess, that I will have to check for WM_KEYUP and VK_DELETE

Sorry for taking up forum space with my questions

/Edit: the new key checking code works wonderfully now...apparently the RichEdit control uses WM_CHAR messages for normal characters and WM_KEYDOWN for delete,tab,ctrl+__, etc.

I still don't know whether or not I need to save each RichEdit proc pointer separately though.
Posted on 2003-07-18 22:48:21 by sirchess2