Share via


CToolBarCtrl::AddStrings

Adds a new string or strings to the list of strings available for a toolbar control.

int AddStrings( 
   LPCTSTR lpszStrings  
);

Parameters

  • lpszStrings
    Address of a buffer that contains one or more null-terminated strings to add to the toolbar's string list. The last string must be terminated with two null characters.

Return Value

The zero-based index of the first new string added if successful; otherwise –1.

Remarks

Strings in the buffer must be separated by a null character. You must ensure that the last string has two null terminators. To properly format a constant string, you might write it as:

// one null added automatically
lpszStrings = _T("Only one string to add\0");   

or:

// adds three strings with one call
lpszStrings = _T("String 1\0String 2\0String 3\0");   

You should not pass a CString object to this function since it is not possible to have more than one null character in a CString.

Requirements

Header: afxcmn.h

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

CToolBarCtrl::AddString

CToolBarCtrl::AddButtons

CToolBarCtrl::InsertButton

CToolBarCtrl::AddBitmap