Click here to Skip to main content
15,907,396 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to add icons in the menu bar as same as we observe in the paint, word application using MFC application wizard in vc++ 6.0 tool can any one tell me the procedure to add the icons.

Please give me the best solution for this



Thanks in advance............
Posted

1 solution

add the below code in CMainFrame::OnCreate() function
CBitmap* bitmap1 = new CBitmap;
CBitmap* bitmap2 = new CBitmap;

bitmap1->LoadBitmap( IDB_BITMAP1 );
bitmap2->LoadBitmap( IDB_BITMAP2 );
CMenu* pMenu = 0;
HMENU hMenu = 0;
pMenu = GetMenu();
pMenu = pMenu->GetSubMenu(0);
pMenu->SetMenuItemBitmaps(0, MF_BYPOSITION, bitmap1, bitmap2 );


in case of simple SDI application it will set a bitmap to File->New menu.

do not forget to detsroy bitmap object and delete the memory inside CMainFrame detsructor CMainFrame::~CMainFrame()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900