Question: I can use an bitmap in a menu

```
CMenu men;
CBitmap b;
b.LoadBitmap(IDB_0); 
men.AppendMenu( MF_ENABLED,1,&b);

```

I can draw an icon into a DC

```
  CImageList IL;
  IL.Create(70, 14, ILC_COLOR16 | ILC_MASK, 1, 0);
  IL.Add(AfxGetApp()->LoadIcon(IDI_0));
  IL.Draw ( pDC,  0,  rcIcon.TopLeft(),  ILD_BLEND50 );

```

But I cannot find a simple way to show an icon in a menu. I would like to do this

```
CMenu men;
CBitmap b;
// here the miracle happens, load the icon into the bitmap
men.AppendMenu( MF_ENABLED,1,&b);

```

Seems like this should be possible.

---

This is the same question as [this](https://stackoverflow.com/questions/70386/icons-on-menus-of-mfc-feature-pack-classes). However that question referred to the MFC feature pack, did not get answered, and has shown no activity for a month, so I thought it would be worthwhile to ask it again in reference to basic MFC.

Answer: 
On Windows Vista/Windows7 you can not do that, it's either a 32 BGRA image or the menu is not drawn in the new UI style. There is no workaround, maybe ownerdrawing but i read the style API is not working correctly with menus, so i never tried to get deeper in it.

You should use 32bit BGRA Icons anyway.
In order to set up a bitmap for a menu, you need to call CMenu::SetMenuItemInfo() for each item with something like this:

```
MENUITEMINFO mii;
mii.cbSize = sizeof mii;
mii.fMask = MIIM_BITMAP;
mii.hbmpItem = bitmapHandle;
menu.SetMenuItemInfo(menuItem,&mii,TRUE);

```

A further complication with doing this is that this is okay for 256 colour bitmaps, but not full colour 32bit RGBA bitmaps - these will work, but only on Vista, and then only if you present the bitmap as pre-computed RGBA.

In practice, in my code I get round this by using another feature of menu icons, which is to set the hbmpItem to HBMMENU\_CALLBACK, which allows a callback to draw the bitmap: I do that for Windows XP and before. The code gets a bit too complicated to post here. As an example, you could have a look at my code at

<http://www.ifarchive.org/if-archive/infocom/interpreters/frotz/WindowsFrotzSrc.zip>

Look in "MenuBar.h" and "MenuBar.cpp", particularly the code around MenuBar::SetBitmaps().