I tried copying the CMenu
Contents into CMFCPopupMenu
using CMFCPopupMenu::Create()
Method. All the CMenu
Items are shown in PopUpMenu but Bitmaps are not Visible. I could not understand why.
When I insert CMenu
in Toolbar the Bitmaps are displayed.
Below is my implemented code snippet from simple MFC Application.
CMenu* TestCMenu = new CMenu();
TestCMenu->CreateMenu();
//creare submenu's
CMenu* subMenu1 = new CMenu();
//make submenu popup
subMenu1->CreatePopupMenu();
HBITMAP hBitMap = (HBITMAP)LoadImage(NULL, L"SampleBitmap.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
subMenu1->AppendMenu(MF_STRING, ID_NEW, TEXT("New"));
subMenu1->SetMenuItemBitmaps(ID_NEW, MF_STRING, CBitmap::FromHandle(hBitMap), CBitmap::FromHandle(hBitMap));
subMenu1->AppendMenu(MF_STRING, ID_EXIT, TEXT("Exit"));
subMenu1->SetMenuItemBitmaps(ID_EXIT, MF_STRING, CBitmap::FromHandle(hBitMap), CBitmap::FromHandle(hBitMap));
SetMenu(TestCMenu);
Below is my implemented code snippet using CMFCPopupMenu
CMFCPopupMenu* TestCMFCPopMenu = new CMFCPopupMenu;
TestCMFCPopMenu->SetAutoDestroy(FALSE);
TestCMFCPopMenu->Create(this, 1000,400, subMenu1->GetSafeHmenu());
In the 2nd image you see that Bitmaps are Not shown.
Could you please suggest what am I doing wrong?