IContextMenu
私のCOMサーバーの実装では、QueryContextMenu
は呼び出されます(ロギングで確認できます)が、呼び出されInvokeCommand
ません。これがQueryContextMenu
:
HRESULT ContexMenuImp::QueryContextMenu(HMENU hmenu,UINT indexMenu,UINT idCmdFirst,
UINT idCmdLast,UINT uFlags)
{
if (uFlags & CMF_DEFAULTONLY) {
// shouldn't handle this situation:
LOG("IContextMenu::QueryContextMenu: (...,CMF_DEFAULTONLY)");
return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,0);
}else if (InsertMenuItem(hmenu,indexMenu,TRUE,&globals.menuItemInfo) == FALSE){
// error occurred:
LOG("IContextMenu::QueryContextMenu: Error: %d",GetLastError());
return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,0);
} else{
// the desired situation: add item to the menu:
LOG("IContextMenu::QueryContextMenu(hMenu,indexMenu:%u,idCmdFirst:%u,idCmdLast:%u,0x%x): All set...",
indexMenu,idCmdFirst,idCmdLast,uFlags);
return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,1/*handle only a single item*/);
}
}
理由は何ですか?