User info. on menu items? Help!! |
Post Reply |
Author | |||
cjsoft
Newbie Joined: 20 January 2004 Status: Offline Points: 1 |
Post Options
Thanks(0)
Posted: 20 January 2004 at 8:47am |
||
I have an application that generates at runtime a rather large popup menu (on right click). The user action to perform (when selected) on every item is the same, just the information associated with each item is different. So rather than define a command id for every item (there are potentially thousands), I want to use the same command id for each item, but just set user info. to each menu item. This I have achieved (I think) by using 'SetMenuItemInfo', but I can't find out how to retrieve this information once a menu item has been selected by the user - obviusly when the routed command hits my window, the menu has already been destroyed, and I'm not sure how to retrieve it anyway. The windows message 'WM_MENUCOMMAND' seems to indicate it might do what I want, but I can't work out how to integrate this into the my class. This is driving me nuts!!! Any ideas anyone? Thanks, Colin Edited by cjsoft |
|||
vladsch
Newbie Joined: 04 February 2004 Location: Canada Status: Offline Points: 30 |
Post Options
Thanks(0)
|
||
This is from MSDN: The WM_MENUCOMMAND message is sent only for menus that are defined with the MNS_NOTIFYBYPOS flag set in the dwStyle member of the MENUINFO structure. If you have that covered then add the following to your message map for the window:
define in your window class header for the window:
And add the function (assuming CMainFrame is your window class name):
I did not test this code because in my app I don't have any bypos menu items.
|
|||
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
||
Maybe you could look at the DynamicPopus sample. This might illustrate the functionality you are looking for.
|
|||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |