这个继承CWinApp和CBCGPWorkspace的程序,我在哪个视图里面,在框架窗口里面定义加速键函数,都不触发执行函数
但是它那里面的新建,打开加速键函数都能执行我自己重新写个多文档的程序,在哪都能触发我定义的快捷键函数

解决方案 »

  1.   

    不知道对不对,你在ResourceView视图中的Accelerator下编辑你的快捷键.
    试试看!
      

  2.   

    Accelerator里面添加了我的快捷键了
    但是就是不响应我的函数
      

  3.   


    BOOL CXXView::PreTranslateMessage(MSG* pMsg)
    {
    if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
    {
    // finally, translate the message
    HACCEL hAccel = GetDefaultAccelerator();
    return hAccel != NULL &&  ::TranslateAccelerator(m_hWnd, hAccel, pMsg);
    }
       .....
    }
      

  4.   

    程序默认的函数是
    BOOL CLookupConfigView::PreTranslateMessage(MSG* pMsg) 
    {
    return CView::PreTranslateMessage(pMsg);
    }我直接把这段代码BOOL CXXView::PreTranslateMessage(MSG* pMsg)
    {
    if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
    {
    // finally, translate the message
    HACCEL hAccel = GetDefaultAccelerator();
    return hAccel != NULL &&  ::TranslateAccelerator(m_hWnd, hAccel, pMsg);
    }
       .....
    }
    加到return CView::PreTranslateMessage(pMsg);的前面吗是这样的吗
    但是GetDefaultAccelerator不是mfc的函数啊
    编译报错