ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ObjectArx 2010 Menu Bar - MFC

1 REPLY 1
Reply
Message 1 of 2
eran
1588 Views, 1 Reply

ObjectArx 2010 Menu Bar - MFC

Hello All!

I am using a class from ObjectARx 2010 sample kit(AsdkMfcComSamp_dg) code called CAcadPopupMenus to add a pop menu to the menu bar. This class is great and gives me the functionality I need but I am wondering about two things:

1.How can I disable menu items?
2.How can I hide(not remove) menu items?

One more way I tried adding a menu is by using class AdMenuBar. This was also unsuccessful:

AdApplicationFrame* pApplication = acedGetApplicationFrame();
AdMenuBar* pACMenuBar = pApplication->GetMenuBar();
HMENU hMenuBar = pACMenuBar->GetMenuHandle();
CMenu* pMfcMenu = new CMenu;
pMfcMenu->Attach(hMenuBar);
pMfcMenu->CreatePopupMenu();

pMfcMenu->AppendMenu(MF_STRING | MF_ENABLED | MF_BYCOMMAND, IDM_SOLIDACM_START, solidcam_start_menu);
pMfcMenu->AppendMenu(MF_STRING | MF_GRAYED | MF_BYCOMMAND, IDM_SOLIDACM_END , solidcam_end_menu );
pMfcMenu->AppendMenu(MF_POPUP, (UINT) (HMENU) *pMfcMenu, solidcam_menu);

pACMenuBar->UpdateMenu();

This is one way I tried which did not work out. Should I use AdMenuBar->AddMenuItem? I tried but it also unsuccsessful. Maybe I am doing something wrong:

AdApplicationFrame* pApplication = acedGetApplicationFrame();
AdMenuBar* pACMenuBar = pApplication->GetMenuBar();
HMENU hMenuBar = pACMenuBar->GetMenuHandle();
CMenu* pMfcMenu = new CMenu;
pMfcMenu->CreatePopupMenu();

MENUITEMINFO MenuItemInfo;

pMfcMenu->AppendMenu(MF_STRING | MF_ENABLED | MF_BYCOMMAND, IDM_SOLIDACM_START, solidcam_start_menu);
pMfcMenu->AppendMenu(MF_STRING | MF_GRAYED | MF_BYCOMMAND, IDM_SOLIDACM_END , solidcam_end_menu );

pMfcMenu->AppendMenu(MF_POPUP, (UINT) (HMENU) *pMfcMenu, solidcam_menu);
pACMenuBar->AddMenuItem(pMfcMenu->GetSafeHmenu(), //HMENU hMenu);
5, //UINT nPos - Random
MenuItemInfo, //const MENUITEMINFO& menuItem Empty - Problem?
NULL, // LPFNADMENUCALLBACK pfnCallback - Not sure what to put here
_T("Menu Test") //const wchar_t *wszHelpString - For Doc??
);

AddMenuItem returns 0. I am pretty sure I am doing something wrong but I am not sure...

Any help would be extremely appreciated!

Thanks!
David Somekh
Software Engineer
david.somekh@solidcam.com
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: eran

Hi, eran!

e> I am using a class from ObjectARx 2010 sample kit(AsdkMfcComSamp_dg) code
e> called CAcadPopupMenus to add a pop menu to the menu bar. This class is
e> great and gives me the functionality I need but I am wondering about two
e> things:
e> 1.How can I disable menu items?

You can use PopupMenuItem.Enable(FALSE) method.
Look at AutoCAD 2010 Help->Developer Help->ActiveX and VBA Reference->Objects->PopupMenuItem object
Enable property example

e> 2.How can I hide(not remove) menu items?

As I know it is impossible hide menu item without removing it.

Best Regards,
Alexander Rivilis.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost