G
Guest
Hi
In trying to create a RICHEDIT-derived ActiveX control in ATL, I've managed
to successfully implement the stock font property, thanks for all your help
on this.
I'm now stuck on receiving notification that the text has changed.
I selected a stock Text property when creating the control, which put an
OnTextChanged event handler into my control's main class. This never seems to
get called, even when I put code to set the event mask appropriately in the
OnCreate, which now looks like this:
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&
/*bHandled*/)
{
RECT rc;
GetWindowRect(&rc);
rc.right -= rc.left;
rc.bottom -= rc.top;
rc.top = rc.left = 0;
m_hLibRichEdit = LoadLibrary(_T("RICHED32.DLL"));
m_ctlRichEdit.Create(m_hWnd, rc);
DWORD dwEvents = m_ctlRichEdit.SendMessage(EM_GETEVENTMASK);
m_ctlRichEdit.SendMessage(EM_SETEVENTMASK, 0, dwEvents | ENM_CHANGE);
return 0;
}
I tried another tack - selected the control's main class in Class view, went
to properties, chose messages, and added a handler through the wizard for
WM_CHAR. It never gets called either, even when I've noticed that while I'm
pressing keys to type text into the RICHEDIT, it is receiving WM_CHAR
messages as shown by Spy++. (The WM_CHAR handler is as shown below)
LRESULT Ctextchange::OnChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
/*lParam*/, BOOL& /*bHandled*/)
{
ATLTRACE(_T("OnChar fired!")); //never gets called.
return S_OK;
}
I'm now at a loss, so can anybody suggest anything? Thanks ever so.
In trying to create a RICHEDIT-derived ActiveX control in ATL, I've managed
to successfully implement the stock font property, thanks for all your help
on this.
I'm now stuck on receiving notification that the text has changed.
I selected a stock Text property when creating the control, which put an
OnTextChanged event handler into my control's main class. This never seems to
get called, even when I put code to set the event mask appropriately in the
OnCreate, which now looks like this:
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&
/*bHandled*/)
{
RECT rc;
GetWindowRect(&rc);
rc.right -= rc.left;
rc.bottom -= rc.top;
rc.top = rc.left = 0;
m_hLibRichEdit = LoadLibrary(_T("RICHED32.DLL"));
m_ctlRichEdit.Create(m_hWnd, rc);
DWORD dwEvents = m_ctlRichEdit.SendMessage(EM_GETEVENTMASK);
m_ctlRichEdit.SendMessage(EM_SETEVENTMASK, 0, dwEvents | ENM_CHANGE);
return 0;
}
I tried another tack - selected the control's main class in Class view, went
to properties, chose messages, and added a handler through the wizard for
WM_CHAR. It never gets called either, even when I've noticed that while I'm
pressing keys to type text into the RICHEDIT, it is receiving WM_CHAR
messages as shown by Spy++. (The WM_CHAR handler is as shown below)
LRESULT Ctextchange::OnChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
/*lParam*/, BOOL& /*bHandled*/)
{
ATLTRACE(_T("OnChar fired!")); //never gets called.
return S_OK;
}
I'm now at a loss, so can anybody suggest anything? Thanks ever so.