CToolBarCtrl::AddButtons

BOOL AddButtons( int nNumButtons, LPTBBUTTON lpButtons );

Return Value

Nonzero if successful; otherwise zero.

Parameters

nNumButtons

Number of buttons to add.

lpButtons

Address of an array of TBBUTTON structures that contains information about the buttons to add. There must be the same number of elements in the array as buttons specified by nNumButtons.

Remarks

Call this function to add one or more buttons to a toolbar control.

The lpButtons pointer points to an array of TBBUTTON structures. Each TBBUTTON structure associates the button being added with the button’s style, image and/or string, command ID, state, and user-defined data:

typedef struct _TBBUTTON {
int iBitmap;// zero-based index of button image
int idCommand;  // command to be sent when button pressed
BYTE fsState;   // button state--see below
BYTE fsStyle;   // button style--see below
DWORD dwData;   // application-defined value
int iString;// zero-based index of button label string
} TBBUTTON;

The members are as follows:

iBitmap

Zero-based index of button image. NULL if no image for this button.

idCommand

Command identifier associated with the button. This identifier is sent in a WM_COMMAND message when the button is chosen. If the fsStyle member has the TBSTYLE_SEP value, this member must be zero.

fsState

Button state flags. It can be a combination of the values listed below:

fsStyle

Button style. It can be a combination of the values listed below:

dwData

User-defined data.

iString

Zero-based index of the string to use as the button’s label. NULL if there is no string for this button.

The image and/or string whose index you provide must have previously been added to the toolbar control’s list using AddBitmap, AddString, and/or AddStrings.

CToolBarCtrl OverviewClass MembersHierarchy Chart

See Also   CToolBarCtrl::InsertButton, CToolBarCtrl::DeleteButton, CToolBarCtrl::AddBitmap, CToolBarCtrl::AddString, CToolBarCtrl::AddStrings