CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    Jan 2003
    I am such an idiot. The reason I thought that OnInitMenuPopup() only gets called once was because I put a break point in there and since it didn't break I assumed.. well, silly me for not realizing that the reason it wasn't breaking was because the string "Files List" no longer exists after the first time (I over write it)! so with this minor modification, I now have a pop up menu that dynamically loads a list of files and refreshes.

    pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
    nID = pPopupMenu->GetMenuItemID( i);
    if(str == "Files List" || nID == ID_EXTERNAL_LIST_1 )

    I can make this even more simple by replacing the above 3 lines with the following 2 lines

    nID = pPopupMenu->GetMenuItemID( i);
    if(nID == ID_FILE_LIST || nID == ID_EXTERNAL_LIST_1 )

    ID_FILE_LIST is the command ID of "Files List"

    too cool. ;-)



  2. #17
    Join Date
    Jan 2014

    Thumbs up Re: MFC:dynamically create a file list in a submenu?

    Thanks guys!!
    This is what I was looking for and got my menus are populated dynamically by the number of files in the specific folder!!

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)