In comctl32.dll resources
small bitmap 120
bigger bitmap 121
HBITMAP hBitmap = LoadBitmap(GetModuleHandle(TEXT("comctl32")), MAKEINTRESOURCE(120));
Bitmap from resource with 2 buttons
void FillToolbar(HWND hWndDlg, int iCtl)
{
TBBUTTON tbb[] = {
{0, IDM_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{1, IDM_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON},
};
HWND hToolbar = GetDlgItem(hWndDlg, iCtl);
if (hToolbar) {
// Load the button images.
TBADDBITMAP tbBitmap;
tbBitmap.hInst = GetModuleHandle(NULL);
tbBitmap.nID = IDR_TOOLBAR1;
SendMessage(hToolbar, TB_ADDBITMAP, 2, (WPARAM)&tbBitmap);
//SendMessage(hToolbar, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
// Add buttons.
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hToolbar, TB_ADDBUTTONS, (WPARAM)NELEMS(tbb), (LPARAM)&tbb);
}
}
EDIT:
If need ToolTips insert TBSTYLE_TOOLTIPS|TBSTYLE_LIST to resource
and use this function:
void FillToolbar(HWND hWndDlg, int iCtl)
{
TBBUTTON tbb[] = {
{STD_FILENEW, IDM_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, (INT_PTR)"New"},
{STD_FILEOPEN, IDM_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, (INT_PTR)"Open"},
};
HWND hToolbar = GetDlgItem(hWndDlg, iCtl);
if (hToolbar) {
// Load the button images.
SendMessage(hToolbar, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
// Add buttons.
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hToolbar, TB_ADDBUTTONS, (WPARAM)NELEMS(tbb), (LPARAM)&tbb);
SendMessage(hToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
}
}