InsertMenu/AppendMenu - How to add Icons to menu and submenus using C++ and win32

前端 未结 2 1250
无人共我
无人共我 2021-01-13 18:53

I have written a shell extension dll context menu program using C++ and win32 programming. The development environment is Visual Studio 2008 and 2010. In the below sample co

相关标签:
2条回答
  • 2021-01-13 19:10

    Reading the definition of SetMenuItemBitmap https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setmenuitembitmaps there is not such a thing as a MF_BITMAP flag.

    The options are MF_BYCOMMAND and MF_BYPOSITION. Seems like that you are trying to use MF_BYCOMMAND but have to use the same values already given to the MenuItens.

    You have also to check for the format of the BITMAP. SetMenuItemBitmaps just acepts monochrome. I was googling to do the same and had success here. Thanks for showing the way.

    0 讨论(0)
  • 2021-01-13 19:23

    CreatePopUpMenu also works. You just had to use InsertMenu instead of AppendMenu.

    0 讨论(0)
提交回复
热议问题