Toolbar problems...
-
Hi! I'm designing a toolbar for my aplication with 64x64 buttons. I want to store them all as 256color bitmaps in resources for my app.. This is the code i'm using:
m_wndToolBar = ::CreateWindowEx (0, TOOLBARCLASSNAME, NULL,ATL_SIMPLE_TOOLBAR_PANE_STYLE, 0, 0, 64, 64, m_hWnd,(HMENU) LongToHandle (ATL_IDW_TOOLBAR), _Module .GetModuleInstance (),NULL); TBBUTTON tbb[3]; char blah[250]; sprintf(blah,"Hamsters!!!"); tbb[0].idCommand = 1; tbb[0].fsState = TBSTATE_ENABLED; tbb[0].fsStyle = BTNS_BUTTON|BTNS_AUTOSIZE; tbb[0].dwData = 0; tbb[0].iBitmap = 0; tbb[0].iString = (int)&blah; tbb[1].idCommand = 2; tbb[1].fsState = TBSTATE_ENABLED; tbb[1].fsStyle = BTNS_BUTTON|BTNS_AUTOSIZE; tbb[1].dwData = 0; tbb[1].iBitmap = 1; tbb[1].iString = (int)&blah; tbb[2].idCommand = 3; tbb[2].fsState = TBSTATE_ENABLED; tbb[2].fsStyle = BTNS_BUTTON|BTNS_AUTOSIZE; tbb[2].dwData = 0; tbb[2].iBitmap = 1; tbb[2].iString = (int)&blah; list .Create(64, 64, ILC_COLOR, 1, 1); CBitmap bmSmall; bmSmall .LoadBitmap (IDB_BITMAP1); list .Add (bmSmall); list .SetBkColor (::GetSysColor (COLOR_3DFACE)); m_wndToolBar .SetButtonStructSize (sizeof (TBBUTTON)); m_wndToolBar .SetExtendedStyle (TBSTYLE_EX_DRAWDDARROWS|TBSTYLE_EX_MIXEDBUTTONS); m_wndToolBar .SetMaxTextRows (1); m_wndToolBar .SetImageList(list); //m_wndToolBar .SetBitmapSize (64,64); m_wndToolBar .SetButtonSize (64,64); m_wndToolBar.AddButtons(3,tbb); m_wndToolBar.UpdateWindow();
My problem is that the toolbar doesn't want to show any of my buttons' images! What am i doing wrong? Thanks:)