CImageList m_NormalList,m_HotList,m_DisableList;
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
/*--------------------------------------------------------------*/
CBitmap m_bmp;
m_bmp.Attach(::LoadImage(AfxGetResourceHandle(), "list_normal", IMAGE_BITMAP,
0, 0,LR_DEFAULTSIZE|LR_CREATEDIBSECTION));
m_NormalList.Create(48, 48, ILC_COLOR24|ILC_MASK, 0, 0);
m_NormalList.Add(&m_bmp,RGB(192,192,192)) ;
m_bmp.Detach();
m_wndToolBar.SendMessage(TB_SETIMAGELIST,0,(LPARAM)m_NormalList.m_hImageList);
m_bmp.Attach(::LoadImage(AfxGetResourceHandle(), "list_hot",IMAGE_BITMAP,
0, 0,LR_DEFAULTSIZE|LR_CREATEDIBSECTION));
m_HotList.Create(48, 48, ILC_COLOR24|ILC_MASK, 0, 0);
m_HotList.Add(&m_bmp,RGB(192,192,192)) ;
m_bmp.Detach();
m_wndToolBar.SendMessage(TB_SETHOTIMAGELIST,0,(LPARAM)m_HotList.m_hImageList);
m_bmp.Attach(::LoadImage(AfxGetResourceHandle(), "list_disable",IMAGE_BITMAP,
0, 0,LR_DEFAULTSIZE|LR_CREATEDIBSECTION));
m_DisableList.Create(48, 48, ILC_COLOR24|ILC_MASK, 0, 0);
m_DisableList.Add(&m_bmp,RGB(192,192,192)) ;
m_bmp.Detach();
m_wndToolBar.SendMessage(TB_SETDISABLEDIMAGELIST,
0,(LPARAM)m_DisableList.m_hImageList);
/*--------------------------------------------------------------*/