CToolbar.AddButtonmethod
Adds a button to a toolbar.
Syntax
FUNCTION AddButton (BYVAL hToolbar AS HWND, BYVAL idxBitmap AS LONG, BYVAL idCommand AS LONG, BYVAL fsState AS UBYTE = 0, BYVAL fsStyle AS UBYTE = 0, BYVAL dwData AS DWORD_PTR = 0, BYVAL pwszText AS WSTRING PTR = NULL) AS BOOLEAN
Parameters
| Name | Description | |
|---|---|---|
hToolbar | Handle to the toolbar control. | |
idxBitmap | Zero-based index of the button image. | |
idCommand | Command identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is chosen. | |
fsState | Button state flags. This member can be a combination of the values listed in Toolbar Button States. | |
fsStyle | Button style. This member can be a combination of the button style values listed in Toolbar Control and Button Styles. | |
dwData | Application-defined value. | |
pwszText | Pointer to a Unicode string that contains text for the button. |
Return value
Returns TRUE if successful, or FALSE otherwise.
Description
Adds one button to a toolbar.
Remarks
If the toolbar was created using the CreateWindowExW function, you must send the TB_BUTTONSTRUCTSIZE message to the toolbar before sending TB_ADDBUTTONSW.
Reference
- Include file
CToolbar.inc - Defined in AfxNova/CToolbar.inc:235
- Documented in Windows/WIndows Controls/CToolbar Class.md
- Topic: CToolbar Class