Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC VC++
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 7:06am
Edited 18-Nov-12 8: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 at 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
0 OriginalGriff 7,065
1 DamithSL 4,989
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,547
4 Kornfeld Eliyahu Peter 4,314


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2014
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