本帖最后由 paniclp 于 2012-10-10 14:07:07 编辑

解决方案 »

  1.   

    非模态对话框消息循环是父窗体的。到父窗体里面触发消息。或者就用PretranslateMessage来截获右击消息
      

  2.   

    非常感谢楼上回答,的确可以用PretranslateMessage
    来处理。不过标题为什么是灰色的?
    应该怎么处理呢?
      

  3.   

    因为焦点不在这个对话框上面啊,它已经内嵌了。焦点归属权为你的View。
    你不喜欢么把标题去掉自己再画一层蓝色的上去
      

  4.   

    我试用PretranslateMsg来截获消息
    然后处理
    BOOL CVideoDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->message == WM_RBUTTONUP)
    {
    CPoint point = pMsg->pt;
    CMenu Menu;    
    Menu.CreatePopupMenu();   
    if(!m_bRecord)
    Menu.AppendMenu(MF_STRING,   ID_START_RECORD,   "开始录像");  
    else
    Menu.AppendMenu(MF_STRING,   ID_STOP_RECORD,   "停止录像");  

    Menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, 
    point.y, AfxGetMainWnd());

    Menu.DestroyMenu();
    }
    return CDialog::PreTranslateMessage(pMsg);
    }我在这个对话框类来响应,但是右键弹出的菜单是灰色的,除非我在MainFrame来添加消息响应。
    我想在这个对话框里面响应这个事件,应该怎么做呢?
      

  5.   

    我想错了,根本原因是Menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x,  
    point.y, AfxGetMainWnd());最后一个参数指向MainFrame所以导致菜单消息发送给MainFrame
    使用对话框指针就可以了