2012-07-03 27 views

回答

1

您需要覆蓋CefMenuHandler中的OnBeforeMenu方法。在您的實現該方法,採用標準技術顯示上下文菜單和返回true:

bool MyMenuHandler::OnBeforeMenu(CefRefPtr<CefBrowser> browser, 
           const CefMenuInfo& menuInfo) 
{ 
    HMENU hPopupMenu = CreatePopupMenu(); 
    InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, ID_POPUP_FOO, "Foo"); 
    TrackPopupMenu(hPopupMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, xpos, ypos, 0, m_hWnd, NULL); 
    return true; 
} 
+0

非常感謝。我可以用我的方法意識到這一點。 –

+0

通過我想要實現Drag函數的方式,並使用ClientHandler重寫OnDragEnter方法,但我無法獲取dragData的文件名,爲什麼?我可以在OnDragStart中獲取文件名。它需要JavaScript嗎?期待你的回答。 –

相關問題