I know how to add icon for nomal menu item using:
AddMenuIcon(int nID_MenuItem, HICON hIcon, int cx /*= 16*/, int cy /*= 16*/)
but for MP_POPUP menu item, it has no menu ID, then how can I add an icon for such menu item?
I don't mean to evade your question, but I'm not sure what you're referring to here. I assume "MP_POPUP" is a miss-type, but MF_POPUP isn't a type of menu item either.
MF_POPUP is a flag used by several functions which work with menus, but these function also have a HMENU parameter. It is the HMENU parameter that defines the menu items along with their associated menu IDs.
thank you for your response.
But, I didn't figure out how to get the itemID of a menu item with MF_POPUP style…
Generally speaking, menu items with the MF_POPUP style don't have an itemID. When the menu is defined in a resource script it is impossible to assign an ID to the menu item, as far as I'm aware.
The function used to retrieve any menu item's information is GetMenuItemInfo. It might be possible to assign an ID to a menu item with the MF_POPUP with the SetMenuItemInfo function, in which case GetMenuItemInfo could be used to retrieve it.
I haven't seen an application display an icon for a menu item with MF_POPUP style, so I suspect that this is a rather unusual thing to do. Still, you can display anything you like for a popup menu if you're prepared to do your own owner-drawing of menus.
David, thank you, I'll have a try.
Log in to post a comment.