Re: CRichEdit issue
Illuminator wrote:
Anybody know this problem?
I'm not sure but it seems the control handles accelerators internally.
In the doc: 'About Rich Edit Controls', see the section 'Rich Edit
Shortcut Keys'. If you spy the control all you will see is the key down
going in, there are no messages reflected. It looks like you will have
to use AliR's solution.
And it seems there is no context menu unless you supply one. And from
what I see in the docs you can use WM_COPY, WM_PASTE... as messages to
the control. Here is one way, see the message 'WM_CONTEXTMENU instead of
WM_RBUTTONUP'
I had this on my drive:
http://www.codeproject.com/richedit/COleRichEditCtrl.asp
So I:
HRESULT STDMETHODCALLTYPE
COleRichEditCtrl::IExRichEditOleCallback::GetContextMenu(WORD seltyp,
LPOLEOBJECT lpoleobj, CHARRANGE FAR *lpchrg,
HMENU FAR *lphmenu)
{
CMenu menu;
menu.CreatePopupMenu( );
menu.InsertMenu( -1, MF_BYPOSITION, WM_PASTE, _T("PASTE") );
menu.InsertMenu( -1, MF_BYPOSITION, WM_CUT, _T("CUT") );
*lphmenu= menu.Detach( );
TRACE( "GetContextMenu\n" );
return S_OK;
}
The menu shows up but the message is sent to the parent dialog!??
So:
void CDevDlg::OnPaste( )
{
cRichControl.SendMessage( WM_PASTE );
}
But then, you wanted to catch these messages.
Wish I could be more help but I don't use a bare control much. I use the
control in a view.