I searched everywhere for an answer to this, but I cant find anything. I have a .bmp file with 5 16 x 16 toolbar images. In my .rc file I have this line (ID_BITMAP is defined in one of my header files as 1111 and NUM_TOOLS is defined as 5):
ID_BITMAP BITMAP "toolbar.bmp"
And then I have this code to create the toolbar:
Code:
HWND hTool = CreateWindowEx(0,TOOLBARCLASSNAME,NULL,WS_CHILD|WS_VISIBLE,0,0,0,0,hWnd,(HMENU)ID_TOOLBAR,hInst,NULL);
SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
TBBUTTON tbb[NUM_TOOLS];
TBADDBITMAP tbab;
tbab.hInst = hInst;
tbab.nID = ID_BITMAP;
SendMessage(hTool, TB_ADDBITMAP, (WPARAM)5, (LPARAM)&tbab);
ZeroMemory(&tbb, sizeof(tbb));
for(a=0;a<NUM_TOOLS;a++) {
tbb[a].fsState = TBSTATE_ENABLED;
tbb[a].fsStyle = TBSTYLE_BUTTON | TBSTYLE_CHECKGROUP;
}
tbb[0].iBitmap = 0;
tbb[0].idCommand = ID_COMMAND1;
tbb[1].iBitmap = 1;
tbb[1].idCommand = ID_COMMAND2;
tbb[2].iBitmap = 2;
tbb[2].idCommand = ID_COMMAND3;
tbb[3].iBitmap = 3;
tbb[3].idCommand = ID_COMMAND4;
tbb[4].iBitmap = 4;
tbb[4].idCommand = ID_COMMAND5;
SendMessage(hTool, TB_ADDBUTTONS, (WPARAM)NUM_TOOLS, (LPARAM)&tbb);
And what I get is 5 all black toolbar buttons. Is there something I'm doing wrong? Also, I'd prefer to have large icons (like 50 x 50 and maybe larger, I havent decided). Would I just make the bitmap larger or what would I have to change? Thanks for any help.