Bitmap menus

How do I make menus with bitmaps on the left side, like in Microsoft office or the Windows 95 start menu? I have tried using the predefined OWL class and many other classes on the Internet but none of them seemed to work.
OwlguruAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexVirochovskyCommented:
The following code is used to create a new profile with the name
supplied as lpszProfileName:
  LPPROFADMIN         m_pProfAdmin;
  MAPIAdminProfiles(0, &m_pProfAdmin)
  m_pProfAdmin->CreateProfile(lpszProfileName, NULL, 0, 0)


Hi,  in this example i add 3 bitmaps as Items in MainMenu,
and every Bitmap has you oun PopMenu:
BTW: Add this menu must not in constructore, but in Setup of in
Paint (1-st time):

next is code.
TMyWindow::Paint(TDC& dc, bool, TRect&)
{
  static bool b1 =false;
  if (!b1)
   {
   HMENU    hMenu = CreateMenu () ;

   HMENU    hMenuPopup = LoadMenu (hInstance, "MenuFile") ;
   //i use bitmaps from directory,you can , of course, use
   //from RC file.
   HBITMAP  hBitmapFile = StretchBitmap (TBitmap("FileLabl.bmp")) ;
   AppendMenu (hMenu, MF_BITMAP | MF_POPUP, (int) hMenuPopup,
                 (PSTR) (LONG) hBitmapFile) ;

   hMenuPopup = LoadMenu (hInstance, "MenuEdit") ;
   HBITMAP  hBitmapEdit = StretchBitmap (TBitmap("EditLabl.bmp")) ;
   AppendMenu (hMenu, MF_BITMAP | MF_POPUP, (int) hMenuPopup,
                 (PSTR) (LONG) hBitmapEdit) ;

   hMenuPopup = CreateMenu () ;

   for (int i = 0 ; i < 3 ; i++)
     {
        HBITMAP hBitmapPopFont = GetBitmapFont (i) ;
        AppendMenu (hMenuPopup, MF_BITMAP, IDM_COUR + i,
                      (PSTR) (LONG) hBitmapPopFont) ;
     }

   HBITMAP  hBitmapFont = StretchBitmap (TBitmap("FontLabl.bmp")) ;
   AppendMenu (hMenu, MF_BITMAP | MF_POPUP, (int) hMenuPopup,
                 (PSTR) (LONG) hBitmapFont) ;

   SetMenu(this->HWindow,hMenu);
   b1 = true;
  }
....
}
 2 function(pure Windows, you can make with OWL):
HBITMAP StretchBitmap (HBITMAP hBitmap1)
{
     BITMAP     bm1, bm2 ;
     HBITMAP    hBitmap2 ;
     HDC        hdc, hdcMem1, hdcMem2 ;
     TEXTMETRIC tm ;

     hdc = CreateIC ("DISPLAY", NULL, NULL, NULL) ;
     GetTextMetrics (hdc, &tm) ;
     hdcMem1 = CreateCompatibleDC (hdc) ;
     hdcMem2 = CreateCompatibleDC (hdc) ;
     DeleteDC (hdc) ;

     GetObject (hBitmap1, sizeof (BITMAP), (PSTR) &bm1) ;

     bm2 = bm1 ;
     bm2.bmWidth      = (tm.tmAveCharWidth * bm2.bmWidth)  / 4 ;
     bm2.bmHeight     = (tm.tmHeight       * bm2.bmHeight) / 8 ;
     bm2.bmWidthBytes = ((bm2.bmWidth + 15) / 16) * 2 ;

     hBitmap2 = CreateBitmapIndirect (&bm2) ;

     SelectObject (hdcMem1, hBitmap1) ;
     SelectObject (hdcMem2, hBitmap2) ;

     StretchBlt (hdcMem2, 0, 0, bm2.bmWidth, bm2.bmHeight,
                 hdcMem1, 0, 0, bm1.bmWidth, bm1.bmHeight, SRCCOPY) ;

     DeleteDC (hdcMem1) ;
     DeleteDC (hdcMem2) ;

     return hBitmap2 ;
}

HBITMAP GetBitmapFont (int i)//for 3 fonts
{
     static char   *szFaceName[3] = { "Courier New", "Arial",
                                      "Times New Roman" } ;
     static LOGFONT lf ;
     HBITMAP        hBitmap ;
     HDC            hdc, hdcMem ;
     HFONT          hFont ;
     SIZE           size ;
     TEXTMETRIC     tm ;

     hdc = CreateIC ("DISPLAY", NULL, NULL, NULL) ;
     GetTextMetrics (hdc, &tm) ;

     lf.lfHeight = 2 * tm.tmHeight ;
     strcpy ((char *) lf.lfFaceName, szFaceName[i]) ;

     hdcMem = CreateCompatibleDC (hdc) ;
     hFont = (HFONT) SelectObject (hdcMem, CreateFontIndirect (&lf)) ;
     GetTextExtentPoint (hdcMem, szFaceName[i], strlen (szFaceName[i]), &size) ;

     hBitmap = CreateBitmap (size.cx, size.cy, 1, 1, NULL) ;
     SelectObject (hdcMem, hBitmap) ;

     TextOut (hdcMem, 0, 0, szFaceName[i], strlen (szFaceName[i])) ;

     DeleteObject (SelectObject (hdcMem, hFont)) ;
     DeleteDC (hdcMem) ;
     DeleteDC (hdc) ;

     return hBitmap ;
}

Part of rc file:
....
MenuFile MENU
     {
     MENUITEM "&New",        IDM_NEW
     MENUITEM "&Open...",    IDM_OPEN
     MENUITEM "&Save",       IDM_SAVE
     MENUITEM "Save &As...", IDM_SAVEAS
     }

MenuEdit MENU
     {
     MENUITEM "&Undo",       IDM_UNDO
     MENUITEM SEPARATOR
     MENUITEM "Cu&t",        IDM_CUT
     MENUITEM "&Copy",       IDM_COPY
     MENUITEM "&Paste",      IDM_PASTE
     MENUITEM "De&lete",     IDM_DEL
     }
....
I hope, it helps. Alex
0
OwlguruAuthor Commented:
Adjusted points to 110
0
OwlguruAuthor Commented:
I use Borland C++ 5.02 with OWL 5.2. This method doesn't seem to work. Can you provide me with some more information(e.g. size and type of bitmaps)?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

AlexVirochovskyCommented:
For test i use BC 5.01 , but it is same.
Write you EMail, and i send you full project(that works, of course!).
0
JPMCommented:
get to my site   http://www.multimania.com/jpmolina
and you'll find out what you wish.
JPM
0
AlexVirochovskyCommented:
owlguru ???
0
AlexVirochovskyCommented:
owlguru, you don't react to my and JPM proposals. I repete my one: i can send you full project, that, of couse, works.
to jpm: if I get PTS, i'll send you same summe.
Alex
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JPMCommented:
thanks Alex.
Jean-Paul
0
JPMCommented:
thanks Alex.
Jean-Paul
0
OwlguruAuthor Commented:
Can you send me the full project at tohatan@interlog.com as soon as possible? Thank you.
0
OwlguruAuthor Commented:
JPM, your site doesn't work! (Page cannot be displayed)
0
JPMCommented:
the URL of my site is :
http://www.multimania.com/jpmolina/index.html
and it works.
( I just had updated my site which has frames right now )
please try again and say whether it works for you or not.
Jean-Paul
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.