let menu item mapped into non_based class ?
I am writing a SDI application using MFC AND
create a modeless dialog with a list_control .
In the menu , i create a menu item and put it
on the toolbar .When I map it into the VIEW
(OR DOC ,FRAME and so on ) it works .BUT
I want map it into my_modeless_dialog (derived
from CDialog ->CWnd->CCmdTarget) .So that
I can use list_control (if i map it in a view or other ,
because list_control is protect member of my_modeless_dialog ,
I can not call the clist_control fanction ).
I find a sample in MSND as below :
BOOL CMyView::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
// Extend the framework's command route from the view to
// the application-specific CMyShape that is currently selected
// in the view. m_pActiveShape is NULL if no shape object
// is currently selected in the view.
if ((m_pActiveShape != NULL)
&& m_pActiveShape->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
// If the object(s) in the extended command route don't handle
// the command, then let the base class OnCmdMsg handle it.
return CView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
but i donot know how to rewrite it and use it in my modeless dialog???
Overriding OnCmdMsg is a way to solve my problem , and
I want to ask another question :Can I use a protect member
of my_modeless_dialog in the VIEW OR other base class???
if this way can be done ,it will be easier than the above overriding
OnCmdMsg .
Thank you in advance !