Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 3:43
toxcct26-Jul-05 3:43 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 3:50
mark novak26-Jul-05 3:50 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 3:59
toxcct26-Jul-05 3:59 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 4:15
mark novak26-Jul-05 4:15 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 5:11
toxcct26-Jul-05 5:11 
GeneralRe: Dynamic popup menu Pin
mark novak26-Jul-05 5:30
mark novak26-Jul-05 5:30 
GeneralRe: Dynamic popup menu Pin
toxcct26-Jul-05 20:35
toxcct26-Jul-05 20:35 
GeneralRe: Dynamic popup menu Pin
mark novak27-Jul-05 1:54
mark novak27-Jul-05 1:54 
Usually what I do with a dynamic menu like that is have a begining ID range and an ending ID range, I define this in the resource header like

#define ID_DYNAMIC_MENU_BEGIN 3000
#define ID_DYNAMIC_MENU_END (ID_DYNAMIC_MENU_BEGIN + 100)

I then call AppendMenu with ID_DYNAMIC_MENU_BEGIN + index;

That would get rid of your m_bPhonesMenuCalled flag because you can just check the wParam to see if it's the range. To get an index use wParam - ID_DYNAMIC_MENU_BEGIN.

Attach()/Detach() are unwanted since they are for menus that already exist. You do however have a resource leak in that you never destroy the menu. After your TrackPopupMenu() you should call DestroyMenu(), with that in place I see no reason for you to Assert by using a CMenu as a member. You were probably ASSERTing by calling CreatePopupMenu() twice without a DestroyMenu().

You ask good questions.


GeneralRe: Dynamic popup menu Pin
toxcct27-Jul-05 2:00
toxcct27-Jul-05 2:00 
GeneralRe: Dynamic popup menu Pin
mark novak27-Jul-05 2:13
mark novak27-Jul-05 2:13 
GeneralString Converstions Pin
tomek1826-Jul-05 2:59
tomek1826-Jul-05 2:59 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 3:02
mark novak26-Jul-05 3:02 
GeneralRe: String Converstions Pin
tomek1826-Jul-05 3:10
tomek1826-Jul-05 3:10 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 3:24
mark novak26-Jul-05 3:24 
GeneralRe: String Converstions Pin
tomek1826-Jul-05 3:18
tomek1826-Jul-05 3:18 
GeneralRe: String Converstions Pin
tomek1826-Jul-05 3:43
tomek1826-Jul-05 3:43 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 4:04
mark novak26-Jul-05 4:04 
GeneralRe: String Converstions Pin
tomek1826-Jul-05 4:17
tomek1826-Jul-05 4:17 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 4:25
mark novak26-Jul-05 4:25 
GeneralRe: String Converstions Pin
Tim Smith26-Jul-05 3:30
Tim Smith26-Jul-05 3:30 
GeneralRe: String Converstions Pin
tomek1826-Jul-05 4:19
tomek1826-Jul-05 4:19 
GeneralRe: String Converstions Pin
mark novak26-Jul-05 4:28
mark novak26-Jul-05 4:28 
GeneralXML parsing in C++ Pin
72arpita26-Jul-05 2:53
72arpita26-Jul-05 2:53 
GeneralRe: XML parsing in C++ Pin
David Crow26-Jul-05 2:59
David Crow26-Jul-05 2:59 
QuestionHow to draw a rectangle in CRichEditCtrl Pin
Ahmed Kabir26-Jul-05 2:33
Ahmed Kabir26-Jul-05 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.