Help Center

CToolbar.InsertButtonmethod

Inserts a button in a toolbar.

WindowsmethodCToolbar.incdocumented

Syntax

FUNCTION InsertButton (BYVAL hToolbar AS HWND, BYVAL idxButton AS LONG, BYVAL pButton AS TBBUTTON PTR) AS BOOLEAN
FUNCTION InsertButton (BYVAL hToolbar AS HWND, BYVAL idxButton AS LONG, BYREF Button AS TBBUTTON) AS BOOLEAN
FUNCTION InsertButton (BYVAL hToolbar AS HWND, BYVAL idxButton AS LONG, 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

NameDescription
hToolbarHandle to the toolbar control.
idxButtonZero-based index of a button. The message inserts the new button to the left of this button.
pButtonPointer to a TBBUTTON structure containing information about the button to insert.
ButtonA TBBUTTON structure containing information about the button to insert.
idxBitmapZero-based index of the button image. Set this member to I_IMAGECALLBACK, and the toolbar will send the TBN_GETDISPINFO notification code to retrieve the image index when it is needed.
idCommandCommand identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is chosen.
fsStateButton state flags. This member can be a combination of the values listed in Toolbar Button States.
fsStyleButton style. This member can be a combination of the button style values listed in Toolbar Control and Button Styles.
dwDataApplication-defined value.
pwszTextPointer to a string buffer that contains text for the button.

Description

Inserts a button in a toolbar.

Reference

  • Include file CToolbar.inc
  • Defined in AfxNova/CToolbar.inc:267
  • Documented in Windows/WIndows Controls/CToolbar Class.md
  • Topic: CToolbar Class