在VC中使用MapX,添加了MapX的点击事件,可以响应消息,但是原来View类中的左击和右击似乎被屏蔽了,无法响应消息。请问该如何解决?急用

解决方案 »

  1.   

    在程序中添加DISPID_MOUSEUP事件 BOOL CExampleView::OnMouseUpInMap(short Button, short Shift,OLE_XPOS_PIXELS x,OLE_YPOS_PIXELS y)
    {
    if (Button == 2) { //此处Button==1表示鼠标左键,Button ==2表示右键 CMenu menu; // top-level menu CMenu *pMenu=NULL; // pop-up menu // Load the menu resource.
    menu.LoadMenu(IDR_CONTEXTMENU); // TrackPopupMenu cannot display the top-level menu, so get // the handle of the first pop-up menu. pMenu = menu.GetSubMenu(0); if (!pMenu) { return TRUE; } //SetMenuDefaultItem(pMenu->m_hMenu,1,TRUE); // Display the floating pop-up menu. Track the right mouse // button on the assumption that this function is called // during WM_CONTEXTMENU processing. POINT pt; GetCursorPos(&pt); pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x, pt.y, this, NULL); // Destroy the menu. menu.DestroyMenu();
    }
    return TRUE;
    }