Example for WM_INITDIALOG
FillToolbar(hwndDlg, 4001);
void FillToolbar(HWND hWndDlg, int iCtl)
{
TBBUTTON tbb[] = {
{STD_FILENEW, IDM_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{STD_FILEOPEN, IDM_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON},
};
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);
}
}