Click to See Complete Forum and Search --> : Adding a bitmap to a toolbar button why isn't this working?


Icyculyr
February 24th, 2008, 09:31 PM
TBBUTTON tbb[1];
TBADDBITMAP tbab;
tbab.hInst = HINST_COMMCTRL;
tbab.nID = IDB_STD_SMALL_COLOR;
SendMessage(mainTB, TB_ADDBITMAP, 0, (LPARAM)&tbab);

ZeroMemory(tbb, sizeof(tbb));

tbb[0].iBitmap = IDB_BGGBTN_GRAY; //this line for my button image (i think)
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = MAINTB_MAINMENU;

IDB_BGGBTN_GRAY is defined in my resource editor (VC++)

I added the file into my resources file, and named it IDB_BGGBTN_GRAY

but it doesn't show...

Does anyone know why?

Thanks

Boris K K
February 25th, 2008, 04:52 AM
You must not use

tbab.hInst = HINST_COMMCTRL;


unless you want to use a system bitmap. Use the application's HINSTANCE or the HINSTANCE of a .dll depending on where the resource is located.