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: 
I asked the question you reference.

The way to add (normal, 16-bit color) icons to menus is to make a toolbar with the same resource id as the menu you want to have icons in. You then assign id's to each of the toolbar buttons, the same id's as the menu entries. Make a wizard-generated new MFC application and you'll see how it works there.

The answers to the question I posted suggested that it should work the same for 32-bit images with transparency for the Feature Pack toolbars; I haven't gotten around to test it out though.

If your specific problem is how to make dynamically-generated menus, I think you should pass the id of an existing entry in a toolbar and then that image will be used.

Not a real answer to your question but maybe it'll point you in the right direction.
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().