I've added a toolbar to my programme using code I pretty much copied keyword for keyword from theForger's tutorial. I now have two problems with the tool bar.
1) The tool bar appears inside the client area of the window(as in right beside the verticle scrollbar), is there any EASY way I can move it up out of the client area?
2) Once I've added some standard butons for things like new and open, how do I add another bitmap for some other buttons?
For anyone who's interested, here's my version of the code
Code:
HWND hwToolBar;
TBADDBITMAP tbabToolBar;
TBBUTTON tbbToolBar[3];
hwToolBar = CreateWindowEx(0,
TOOLBARCLASSNAME,
NULL,
WS_CHILD | WS_VISIBLE |
TBSTYLE_TOOLTIPS | CCS_ADJUSTABLE,
0,
0,
0,
0,
hwnd,
(HMENU)IDT_MAIN_TOOLBAR,
GetModuleHandle(NULL),
NULL);
crMain.ToolW = hwToolBar;
SendMessage(hwToolBar,
TB_BUTTONSTRUCTSIZE,
(WPARAM)sizeof(TBBUTTON),
0);
tbabToolBar.hInst = HINST_COMMCTRL;
tbabToolBar.nID = IDB_STD_SMALL_COLOR;
SendMessage(hwToolBar, TB_ADDBITMAP, 0, (LPARAM)&tbabToolBar);
ZeroMemory(tbbToolBar, sizeof(tbbToolBar));
tbbToolBar[0].iBitmap = STD_FILENEW;
tbbToolBar[0].fsState = TBSTATE_ENABLED;
tbbToolBar[0].fsStyle = TBSTYLE_BUTTON;
tbbToolBar[0].idCommand = IDM_F_NEW;
tbbToolBar[1].iBitmap = STD_FILEOPEN;
tbbToolBar[1].fsState = TBSTATE_ENABLED;
tbbToolBar[1].fsStyle = TBSTYLE_BUTTON;
tbbToolBar[1].idCommand = IDM_F_OPEN;
tbbToolBar[2].iBitmap = STD_FILESAVE;
tbbToolBar[2].fsState = TBSTATE_ENABLED;
tbbToolBar[2].fsStyle = TBSTYLE_BUTTON;
tbbToolBar[2].idCommand = IDM_F_SAVEAS;
SendMessage(hwToolBar,
TB_ADDBUTTONS,
sizeof(tbbToolBar)/sizeof(TBBUTTON),
(LPARAM)&tbbToolBar);