How can I make it so that a menu item starts out grayed, but then when two variables are at a certain value, it becomes ungrayed and accessable?
I am using Dev C++
Platform: Windows XP
How can I make it so that a menu item starts out grayed, but then when two variables are at a certain value, it becomes ungrayed and accessable?
I am using Dev C++
Platform: Windows XP
Code:if( !SomethingOrOther) { EnableMenuItem(hMenu, IDM_FILE_EDIT, MF_GRAYED); } else { EnableMenuItem(hMenu, IDM_FILE_EDIT, MF_ENABLED); }
Favorite Quote:
>For that reason someone invented C++.
BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!
EnableMenuItem function lets you enable, disable, or gray out an item.
I tried that, but I get the error that hMenu is undeclared. What is supposed to be there? Sorry if this seems obvious to you, I'm not the best at this .
Well naturally, you need to supply the handle of your menu, you may not call it hMenu.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
Sorry if I'm sounding silly...but what do you mean?Originally Posted by adrianxw
You need to look up 'LoadMenu'.
Favorite Quote:
>For that reason someone invented C++.
BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!
Would you mind elaborating on that a bit? That doesn't help me at all.Originally Posted by Bajanine
Did you try to look it up? MSDN
What exactly have you tried?
Favorite Quote:
>For that reason someone invented C++.
BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!
If I say use......
HMENU hMenu=GetMenu(hWnd);
will you ask what hWnd is?
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Look, I am not as good as you people at this.
I found the LoadMenu line in my code...
...and I tried everything from it, but nothing is working. So if you people are just saying simply one sentence, then it's not going to help much.Code:SetMenu(hwnd,LoadMenu(hinstance, "MYMENU"));
So, what do I put instead of hMenu?
See EnableMenuItem for detailsCode:HMENU hMenu = GetMenu ( hWnd ) ; if ( ucGreyItem ) EnableMenuItem ( hMenu, YOUR_ITEMS_UNIQUE_ID_OR_INDEX, MF_GREYED | MF_DISABLED ) ; else EnableMenuItem ( hMenu, YOUR_ITEMS_UNIQUE_ID_OR_INDEX, MF_ENABLED ) ;