I'm creating a dynamic popup menu without generating resource ids. How can I keep track of the clicked action without a resource id?
Is there any way I can get menu's string value?
CMenu m_subMenu;
m_subMen开发者_StackOverflow中文版u.CreatePopupMenu();
utf16string actionName(L"");
int nCatgryId = 1000;
for( ; itr != itrEnd ; ++itr)
{
actionName = itr->first;
CString csActionName = actionName.c_str();
AppendMenu(MF_STRING,nId++, csActionName);
}
So how do I obtain the value from the menu when an action is clicked?
#define YOURMENU_ID WM_APP+10
...
AppendMenu(.., YOURMENU_ID,...);
And handle it in WM_COMMAND
Every menu item, when you create it, needs to have an ID. You need to reserve a list of ID's, use those to create the menu items, then use the normal menu functions to get information on them.
精彩评论