This documentation is archived and is not being maintained.


Adds one or more button images to the list of button images stored in the toolbar control.

int AddBitmap(
   int nNumButtons,
   UINT nBitmapID 
int AddBitmap(
   int nNumButtons,
   CBitmap* pBitmap 


Number of button images in the bitmap.
Resource identifier of the bitmap that contains the button image or images to add.
Pointer to the CBitmap object that contains the button image or images to add.

Return Value

Zero-based index of the first new image if successful; otherwise – 1.


You can use the Windows API CreateMappedBitmap to map colors before adding the bitmap to the toolbar. If you pass a pointer to a CBitMap object, you must ensure that the bitmap is not destroyed until after the toolbar is destroyed.

See Also

CToolBarCtrl Overview | Class Members | Hierarchy Chart | CToolBarCtrl::AddButtons | CToolBarCtrl::InsertButton | CToolBarCtrl::AddString | CToolBarCtrl::AddStrings