I have created a toolbar as follows:
I would like to change Button[13] to a Bitmap loaded as a resource. Does anyone know how to do this? I tried just changing the iBitmap part of the structure, but this did not work.Code:TBADDBITMAP Bitmap; TBBUTTON Button[14]; hTool = CreateWindowEx(0, TOOLBARCLASSNAME, "", WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, 0, 0, 0, 0, hwnd, NULL, ghInstance, NULL); SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0); Bitmap.hInst = HINST_COMMCTRL; Bitmap.nID = IDB_STD_SMALL_COLOR; SendMessage(hTool, TB_ADDBITMAP, 0, (LPARAM) &Bitmap); ZeroMemory(Button, sizeof(Button)); Button[0].iBitmap = STD_FILENEW; Button[0].fsState = TBSTATE_ENABLED; Button[0].fsStyle = TBSTYLE_BUTTON; Button[0].idCommand = MENU_FILE_NEW; Button[1].iBitmap = STD_FILEOPEN; Button[1].fsState = TBSTATE_ENABLED; Button[1].fsStyle = TBSTYLE_BUTTON; Button[1].idCommand = MENU_FILE_OPEN; Button[2].iBitmap = STD_FILESAVE; Button[2].fsState = TBSTATE_ENABLED; Button[2].fsStyle = TBSTYLE_BUTTON; Button[2].idCommand = MENU_FILE_SAVE; Button[3].iBitmap = STD_PRINT; Button[3].fsState = TBSTATE_ENABLED; Button[3].fsStyle = TBSTYLE_BUTTON; Button[3].idCommand = MENU_FILE_PRINT; Button[4].fsStyle = TBSTYLE_SEP; Button[5].iBitmap = STD_CUT; Button[5].fsState = TBSTATE_ENABLED; Button[5].fsStyle = TBSTYLE_BUTTON; Button[5].idCommand = MENU_EDIT_CUT; Button[6].iBitmap = STD_COPY; Button[6].fsState = TBSTATE_ENABLED; Button[6].fsStyle = TBSTYLE_BUTTON; Button[6].idCommand = MENU_EDIT_COPY; Button[7].iBitmap = STD_PASTE; Button[7].fsState = TBSTATE_ENABLED; Button[7].fsStyle = TBSTYLE_BUTTON; Button[7].idCommand = MENU_EDIT_PASTE; Button[8].fsStyle = TBSTYLE_SEP; Button[9].iBitmap = STD_UNDO; Button[9].fsState = TBSTATE_ENABLED; Button[9].fsStyle = TBSTYLE_BUTTON; Button[9].idCommand = MENU_EDIT_UNDO; Button[10].iBitmap = STD_FIND; Button[10].fsState = TBSTATE_ENABLED; Button[10].fsStyle = TBSTYLE_BUTTON; Button[10].idCommand = MENU_SEARCH_FIND; Button[11].iBitmap = STD_REPLACE; Button[11].fsState = TBSTATE_ENABLED; Button[11].fsStyle = TBSTYLE_BUTTON; Button[11].idCommand = MENU_SEARCH_REPLACE; Button[12].fsStyle = TBSTYLE_SEP; Button[13].iBitmap = STD_HELP; Button[13].fsState = TBSTATE_ENABLED; Button[13].fsStyle = TBSTYLE_BUTTON; Button[13].idCommand = MENU_HELP_TOPIC; SendMessage(hTool, TB_ADDBUTTONS, 14, (LPARAM) &Button); }
Thanks.
- Sean



LinkBack URL
About LinkBacks


