Print Page | Close Window

Command handlers in MDI view?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=4991
Printed Date: 17 May 2024 at 8:20am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Command handlers in MDI view?
Posted By: znakeeye
Subject: Command handlers in MDI view?
Date Posted: 07 September 2006 at 2:07pm

In an SDI App you simple put all command handlers (menu items etc) in your CMyView.cpp file. This is possible thanks to this:

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
    TRACE0( " CMainFrame::OnCmdMsg() entered\n" );
    // let the view have first crack at the command
    if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
        return TRUE;
    // otherwise, do default handling
    return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
 
Now, how do I do that in an MDI app (with a ribbon bar)? For instance, if a menu item says "print", I want to print the active view. That is, I want to handle this command in that very instance of the view.
 
Suggestions?
Thanks!



Replies:
Posted By: znakeeye
Date Posted: 05 March 2007 at 6:43pm
This is handled internally. The active view will get the first crack at the command, as far as I know.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net