Click here to Skip to main content
13,148,107 members (71,246 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi
I have a program which has a menu.in which at run time several menu items are added to it. I need to process these menu items when they are clicked,,Since I do not know the exact number or ID of the menu items,How can i do that.
I saw This link
But i am not able to implement it in mfc,Can anyone provide me a hint to do it in MFC.
Thanks in advance.
Posted 18-Nov-12 6:06am
Updated 18-Nov-12 7:39am
v6

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If you know the range of command ID, then you can use ON_COMMAND_RANGE.
For example, command id of the dynamic menu items are from 1000 to 2000, then you can handle all commands between these command ids by ON_COMMAND_RANGE( 1000, 2000, OnMenuHandler).
afx_msg void OnMenuHandler(UINT nMenuID_i);

nMenuID_i can be used to identify the id of menu item.
  Permalink  
Comments
anonymous1310 18-Nov-12 13:10pm
   
@Santhosh:Thanks for the answer i also thought about that but i have a nested sub menus ,how will i come to know which sub menu item has the id

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170924.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100