- 积分
- 5172
- 明经币
- 个
- 注册时间
- 2003-4-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
void CreateMenus() { LPDISPATCH pDisp = NULL; pDisp = acedGetAcadWinApp()->GetIDispatch(TRUE); if (pDisp == NULL) return;
IAcadApplication *acadApp = NULL; HRESULT hr = S_OK; hr = pDisp->QueryInterface(IID_IAcadApplication, (LPVOID*)&acadApp); if (FAILED(hr)) { acadApp->Release(); return; }
IAcadMenuGroups *pMenuGroups = NULL; acadApp->get_MenuGroups(&pMenuGroups); _bstr_t myBstrWrapper("XXX.mns"); BSTR bsName = (BSTR)myBstrWrapper; IAcadMenuGroup *pMenuGroup; VARIANT index; VariantInit(&index); V_VT(&index) = VT_I4; V_I4(&index) = 0; pMenuGroups->Load(bsName,index,&pMenuGroup); IAcadPopupMenus *pMenus; pMenuGroup->get_Menus(&pMenus); VariantInit(&index); V_VT(&index) = VT_I4; V_I4(&index) = 2; pMenus->InsertMenuInMenuBar(L"XXX",index); pMenus->Release(); pMenuGroup->Release(); pMenuGroups->Release(); acadApp->Release(); } |
|