[RESOLVED] How to assign a bitmap to a menu item?

I know that I'm supposed to use the SetMenuItemBitmaps() function, however in this specific case this doesn't work.

I've created a COM object which adds a new menu item to the Windows popup menu when you right-click on any file. This works well and the menu is added. However, I want the menu item to have a small icon. I've tried like this without success.

note that this is Delphi code, but it should be understandable to anyone.

function TMySellExtTest.QueryContextMenu(Menu: HMENU; indexMenu, idCmdFirst,
idCmdLast, uFlags: UINT): HResult;
var
submenu: HMENU;
info: TMenuItemInfo;
begin

if ( (uFlags and CMF_DEFAULTONLY) <> 0) then
Result := MakeResult(SEVERITY_SUCCESS, FACILITY_NULL, 0)
else begin
info.dwTypeData := 'First menu title';
info.fType := MFT_STRING;
info.cbSize := SizeOf(TMenuItemInfo);
info.fMask := MIIM_ID or MIIM_TYPE or MIIM_DATA;

info.wID := idCmdFirst;

InsertMenuItem(Menu, indexMenu, true, info);

try
menuBitmap := TBitmap.Create;
menuBitmap.LoadFromResourceName(HInstance, 'MENUICON');
SetMenuItemBitmaps(Menu, idCmdFirst, MF_BYCOMMAND, menuBitmap.Handle, 0)
finally
menuBitmap.Free
end;

Result := MakeResult(SEVERITY_SUCCESS, FACILITY_NULL, 1);
end
end;

I've assigned the idCmdFirst as the ID of the menu item, and then I assign the bitmap to it with SetMenuItemBitmaps(Menu, idCmdFirst, MF_BYCOMMAND, menuBitmap.Handle, 0) However nothing happens...

Anyone knows what am I doing wrong?
[1721 byte] By [gcsaba2] at [2007-11-20 11:42:50]