aaa라는 메뉴를 제거한다.
try{
CComPtr pDisp;
pDisp = acedGetAcadWinApp()->GetIDispatch(TRUE);
CComPtr pComApp;
HRESULT hr = pDisp->QueryInterface(IID_IAcadApplication,(void**)&pComApp);
if(FAILED(hr)) return;
CComPtr pMenuGrps = NULL;
if(FAILED(pComApp->get_MenuGroups(&pMenuGrps))) return;
CComPtr pMenuGrp = NULL;
if(FAILED(pMenuGrps->Item(_variant_t((short)0),&pMenuGrp))) return;
CComPtr pPopupMenus = NULL;
//add a menu item to the first loaded menu group by name "AddedFromArx"
if(FAILED(pMenuGrp->get_Menus(&pPopupMenus))) return;
//_variant_t index=1L;
//pPopupMenus->RemoveMenuFromMenuBar(index);
CComPtr pPopupMenu = NULL;
long lCount=0L;
pPopupMenus->get_Count(&lCount);
for(long l=0;l < lCount;l++){
pPopupMenus->Item(_variant_t((long)l),&pPopupMenu);
BSTR name;
pPopupMenu->get_Name(&name);
CString strName(name);
if(strName == "aaa"){
pPopupMenu->RemoveFromMenuBar();
break;
}
}
}catch(_com_error &es){
//some error handling
}
댓글
댓글 쓰기