Dimming a pop-up menu

How could I dimmed a pop-up menu in run-time when I don't want any of the options in the pop-up menu be active?
maulingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

axrajaCommented:
Assign the menu items' resource ids in a sequence. For example, if u r having a menu contains Add, Sub, Multiply and divide then the resource ids in the .res file should be like this.

Add 100
Sub 101
Multiply 102
Divide 103

paste the code below where u want to grey ur menu..

CMenu mnu;
mnu.LoadMenu (ID_MENU);
//ID_MENU is the resource id for the particular menu;

for (int i = 100; i <= 103; i++)
{
      mnu.EnableMenuItem (i, MF_GRAYED);
}
0
maulingAuthor Commented:
Sorry, I don't want to disable the menu item one by one, but just dimmed the menu so it couldn't select it.
0
captainkirkCommented:
sounds like you would just do as axraja suggested with the top level menu item...
0
migelCommented:
Try this:
// inside window procedure which menu popup you want to disable
{
CMenu* pMenu = GetMenu();
if (pMenu)
{
// nIndex is the popup menu index (zero based in the Window menu bar
pMenu->EnableMenuItem(nIndex, MF_BYPOSITION|MF_GRAYED);
            DrawMenuBar();
}
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Internet Marketing

From novice to tech pro — start learning today.