CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Posts
    13

    Routing MFC toolbar command message to a dialog

    Hi

    I have an MDI app. The app contains a CView with an embedded dialog that hosts an ActiveX control.

    I can handle the MainFrame toolbar click events no problem. How can I propagate the command messages to be handled by the embedded dialog instead of the view?

    I have tried overriding and forwarding OnCmdTarget to the dialog, but the application crashes. I also tried calling UpdateDialogControls( ... ) in the view. The application did not crash but the toolbar button remained grayed out.

    Thanks in advance,

    RP

  2. #2
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: Routing MFC toolbar command message to a dialog

    Quote Originally Posted by CCmdTarget View Post
    Hi

    I have an MDI app. The app contains a CView with an embedded dialog that hosts an ActiveX control.

    I can handle the MainFrame toolbar click events no problem. How can I propagate the command messages to be handled by the embedded dialog instead of the view?

    I have tried overriding and forwarding OnCmdTarget to the dialog, but the application crashes. I also tried calling UpdateDialogControls( ... ) in the view. The application did not crash but the toolbar button remained grayed out.

    Thanks in advance,

    RP
    Can you post how you embed the dialog in the view?
    If you do so I can try to give you a solution. But I don't have the time to reinvent your code at all.

    Where exactly did your application crash?

    With regards
    Programartist

  3. #3
    Join Date
    Aug 2009
    Posts
    13

    Re: Routing MFC toolbar command message to a dialog

    Thanks for the response. I realized almost immediately that I could probably do the same with CFormView--no need to bother with the command routing. My ActiveX control is now crashing in the CFormView, but that's another issue.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured