I wanna make a large toolbar with support of icons with more colors depth than default in Visual Studio. I am using Visual Studio 2005 and the Toolbar is on a CDialog.
I used the Code found : here but did not work.
int CSalariesForm::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDR_MAINFRAME1), IMAGE_BITMAP,
0,0, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);
CBitmap bm;
bm.Attach(hBitmap);
CImageList m_imagelist;
m_imagelist.Create(20, 20, ILC_COLOR8, 4, 4);
m_imagelist.Add(&bm, (CBitmap*) NULL);
cToolBar.Create(this);
cToolBar.GetToolBarCtrl().SetImageList(&m_imagelist);
cToolBar.ShowWindow(SW_SHOW);
cToolBar.SetBarStyle(CBRS_TOOLTIPS | CBRS_FLOATING | CBRS_ALIGN_TOP | CBRS_FLYBY);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
return 0;
}
And when I call the dialog there is no Toolbar shown. What is wong with the code?
Thank You