Help Center

CToolbar.GetButtonTextmethod

Retrieves the display text of a button on a toolbar.

WindowsmethodCToolbar.incdocumented

Syntax

FUNCTION GetButtonText (BYVAL hToolbar AS HWND, BYVAL idButton AS LONG, BYVAL pBuffer AS WSTRING PTR) AS LONG
FUNCTION GetButtonText (BYVAL hToolbar AS HWND, BYVAL idButton AS LONG) AS DWSTRING

Parameters

NameDescription
hToolbarHandle to the toolbar control.
idButtonCommand identifier of the button whose text is to be retrieved.
pBufferPointer to a buffer that receives the button text.

Return value

Returns the length, in characters, of the string pointed to by idButton. The length does not include the terminating null character. If unsuccessful, the return value is -1.

Description

Retrieves the display text of a button on a toolbar.

Remarks

Security Warning: Using the first overloades function incorrectly might compromise the security of your program. This function does not provide a way for you to know the size of the buffer. If you use this function, first call the function passing NULL in the pBuffer, this returns the number of characters, excluding NULL that are required. Then call the function a second time to retrieve the string.

The returned string corresponds to the text that is currently displayed by the button.

Reference

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