回 帖 发 新 帖 刷新版面

主题:Rich Edit 没有EN_CHANGE和EN_UPDATE消息??

我用下面的一句将文本框的消息处理程序改为我自己的.
(这一句在窗口的WM_CREATE消息里)
pOldProcRichEdit = (WNDPROC)SetWindowLong(hEdit_Exp, GWL_WNDPROC,(long)Proc_Edit_Exp);

这里是文本框的消息处理程序:
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
LRESULT CALLBACK Proc_Edit_Exp(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{

    switch (uMsg){
    case EN_CHANGE:
        MessageBox(0,"ENCHANGE",0,MB_OK);
        break;
    case WM_CHAR:
        MessageBox(0,"char",0,MB_OK);
        break;
    default:
        return CallWindowProc(pOldProcRichEdit,hWnd,uMsg,wParam,lParam);
    }
    
    return CallWindowProc(pOldProcRichEdit,hWnd,uMsg,wParam,lParam);
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

但只能接收到WM_CHAR,EN_CHANGE怎么也接收不到,,为什么??

回复列表 (共13个回复)

11 楼

但为什么RichEdit没有消息通知呢??
不太正常的,Windows的消息一向是满天飞的........

12 楼

Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive EN_CHANGE notifications, specify ENM_CHANGE in the mask sent with the EM_SETEVENTMASK message. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. 

也是MSDN里面的内容,就在EN_CHANGE的REMARK段.还有什么问题吗?

13 楼

找到了:Rich Edit Control Event Mask Flags
里面的说明:
The default event mask is ENM_NONE in which case no notification messages are sent to the parent window. You can retrieve and set the event mask for a rich edit control by using the ENM_GETEVENTMASK and ENM_SETEVENTMASK messages.

但发现根本没有ENM_GETEVENTMASK and ENM_SETEVENTMASK这两个的定义,
有的是EM_GETEVENTMASK and EM_SETEVENTMASK..
终于行了.
谢谢!

我来回复

您尚未登录,请登录后再回复。点此登录或注册