请教大家,我有一个SDI界面,主窗体为mainframe, 打开About对话框(模态)后, 如果用户输入快捷键,比如Ctrl+O, 我想让mainframe 来响应该快捷键,请问办得到吗?

解决方案 »

  1.   

    不能,只有About对话框退出了才能
    方法1:About对话框响应,提交给mainframe(父窗口)
    2:全局钩子,由mainframe处理
      

  2.   

    用间接方法可以做到,比如先由模态对话框处理,在模态对话框中通过SendMessage一个自定义消息让主窗口处理。或是用全局键盘钩子。
      

  3.   

    你可以吧About对话框改成非模态对话框
      

  4.   

    不能,只有About对话框退出了才能
    方法1:About对话框响应,提交给mainframe(父窗口)
    2:全局钩子,由mainframe处理
    要不你直接定义热键
      

  5.   


    CAboutDialog::PreTranslateMessage(MSG* pMsg)
    {
        if (::AfxGetMainFrame()->PreTranslateMessage(pMsg))
             return TRUE;
        // or
        //if (::TranslateAccelerator(::AfxGetMainFrame()->GetSateHwnd(), AfxGetMainFrame()->m_hAcceleTable, pMsg)
        //     return TRUE;
        return CDialog::PreTranslateMessage(pMsg);
    }