// The TBBUTTON structure contains information the toolbar buttons.
static TBBUTTON tbButton[] =
{
{0, IDM_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{1, IDM_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{2, IDM_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, -1},
{3, IDM_CUT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{4, IDM_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{5, IDM_PASTE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{6, IDM_PRINT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, -1},
{7, IDM_ABOUT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, -1}
};
// Toolbar ToolTips
TCHAR * szToolTips[] =
{
TEXT("New File"),
TEXT("Open File"),
TEXT("Save File"),
TEXT("Cut"),
TEXT("Copy"),
TEXT("Paste"),
TEXT("Print"),
TEXT("About")
};
// Create the toolbar control.
dwStyle = WS_VISIBLE | WS_CHILD | TBSTYLE_TOOLTIPS |
CCS_NOPARENTALIGN;
if (!(hwndTB = CreateToolbarEx (hwnd,
dwStyle,
(UINT) ID_TOOLBAR,
IMAGECOUNT,
hInst,
IDB_TOOLBAR,
tbButton,
sizeof (tbButton) / sizeof (TBBUTTON),
BUTTONWIDTH,
BUTTONHEIGHT,
IMAGEWIDTH,
IMAGEHEIGHT,
sizeof (TBBUTTON))))
{
return NULL;
}
// Add ToolTips to the toolbar.
SendMessage (hwndTB, TB_SETTOOLTIPS, (WPARAM) IMAGECOUNT,
(LPARAM) szToolTips);
|