Click to See Complete Forum and Search --> : adding bitmap to shell extension menu item


efaxdon
June 4th, 1999, 06:05 PM
I am having trouble getting a bitmap, included as a resource, to display next to my shellcontext menu extention.

This is the latest code that I have tried:
// Insert a separator to remove bolded first menu item
InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);

HBITMAP defaultBitmap2;
if (cEFAXAvail) // if eFax Send is installed
{
// Insert Menu item for eFax with logo bitmap
InsertMenu(hMenu,indexMenu,MF_STRING|MF_BYPOSITION,idCmd++,szMenuText);
defaultBitmap2 = (HBITMAP)LoadImage(g_hmodThisDll,
MAKEINTRESOURCE(IDB_BITMAP2),
IMAGE_BITMAP,
0,
0,
LR_DEFAULTSIZE);
if (!SetMenuItemBitmaps(hMenu,indexMenu++, MF_BYPOSITION, defaultBitmap2, defaultBitmap2))
{
LPVOID lpszMsg;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT),
(LPTSTR) &lpszMsg,0,NULL);
MessageBox(NULL, (const char *)lpszMsg, "SetMenuItemBitmaps Error", MB_ICONWARNING);
}

DrawMenuBar(NULL);

etc...



I don't get any error, but no bitmap is displayed next to the context menu. If I hard code the bitmap location, instead of using a resource, it works fine. Any suggestions?