0

I am trying to add an item to my web browser context menu:

IDR_MENU_HTML_POPUP MENU
BEGIN
    POPUP "CustomPopup"
    BEGIN
        MENUITEM "Select All\tCTRL + A",        31
        MENUITEM SEPARATOR
        MENUITEM "Export",                      CUSTOM_MENU_EXPORT
        MENUITEM SEPARATOR
        MENUITEM "Find\tCTRL + F",              67
        MENUITEM SEPARATOR
        MENUITEM "Page Setup",                  2004
        MENUITEM "Print Preview",               2003
        MENUITEM SEPARATOR
        MENUITEM "Refresh\tF5",                 2300
        MENUITEM SEPARATOR
        MENUITEM "View Source",                 2139
        MENUITEM "View XML",                    CUSTOM_MENU_VIEW_XML
        MENUITEM "Open File Location",          CUSTOM_MENU_OPEN_FILE_LOCATION
    END
END

I already have an answer that I put together here (Is it not possible to add our own menu items on the CHtmlView context menu?) so in theory I expected it to work.

CUSTOM_MENU_OPEN_FILE_LOCATION is defined as 3702 so it iw within this rule:

The menu IDs for all custom menu items fall between IDM_MENUEXT_FIRST__ and IDM_MENUEXT_LAST__ for a maximum of 33 custom commands.

For some reson this menu item is disabled when I display the context menu.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • It seems like I can only use `3700` and `3701`. – Andrew Truckle Jan 08 '22 at 10:41
  • I ended up removing the Export menu item and renumbering the new item as 3701. Now it works. Why am I limited to only 2 menu items? – Andrew Truckle Jan 08 '22 at 13:21
  • Adding a custom context menu is actually adding the corresponding value in the registry. But I don't know much about C++ development, I'm afraid I can't determine the cause of your problem. Here's a nice [related article](https://www.codeguru.com/soap/customize-an-ie-context-menu-to-add-codeguru-favorites/) that you can simply refer to. – Xudong Peng Jan 11 '22 at 09:05
  • @XudongPeng Thanks for the link. If I am right, using the registry affects *all instances* of the browser on the PC. This is why I do it this way instead as it only affects my `CHtmlView` browser. This way is much simpler too to code too. BTW. It is interesting that the sample you linked to also only adds **two** items. – Andrew Truckle Jan 12 '22 at 06:52

0 Answers0