Jump to content
  • Advertisement
Sign in to follow this  
xytor

[Win32] Get pointer to a top menu item?

This topic is 2812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a function that gives me a pointer to an item on the top menu? For example, "File" or "Edit".

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by SiCrane
You can use the EnableMenuItem() function.


That function is great, but how do I use it for a menu item that has a sub-menu? For example, I can easily gray-out "Open", but how can I gray-out "File"?

Share this post


Link to post
Share on other sites
There's one thing you should know about the way menus work in Windows: there's no special distinction between a "top level" menu and a "sub menu". The menu "bar" is actually a menu just like every other: each entry is a menu item with optional sub-menus. The fact that it is rendered horizontally instead of vertically is purely aesthetic.

So, for example, File, Window, Help, etc. are all just menu items in a menu; just as New, Save, and Exit are menu items under a menu. Therefore you can use EnableMenuItem() to do what you want, given the correct handle [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
There's one thing you should know about the way menus work in Windows: there's no special distinction between a "top level" menu and a "sub menu". The menu "bar" is actually a menu just like every other: each entry is a menu item with optional sub-menus. The fact that it is rendered horizontally instead of vertically is purely aesthetic.

So, for example, File, Window, Help, etc. are all just menu items in a menu; just as New, Save, and Exit are menu items under a menu. Therefore you can use EnableMenuItem() to do what you want, given the correct handle [smile]


Right, but unlike the individual menu items, the top-level menu items don't have an id in resource.h. I have ID_FILE_OPEN40001 but not something like ID_FILE.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!