SB_GETTEXT message

Retrieves the text from the specified part of a status window.



Zero-based index of the part from which to retrieve text.


Pointer to the buffer that receives the text as a null-terminated string. Use the SB_GETTEXTLENGTH message to determine the required size of the buffer.

Return value

Returns a 32-bit value that consists of two 16-bit values. The low word specifies the length, in characters, of the text. The high word specifies the type of operation used to draw the text. The type can be one of the following values.

Return codeDescription

The text is drawn with a border to appear lower than the plane of the window.


The text is drawn without borders.


The text is drawn with a border to appear higher than the plane of the window.


The text displays in the opposite direction of the text in the parent window.



Security Warning:  Using this message incorrectly can compromise the security of your program. This message does not provide a way for you to know the size of the buffer. If you use this message, first call SB_GETTEXTLENGTH to get the number of characters that are required and then call the message to retrieve the string. If you wait before calling SB_GETTEXT the text could change, thereby invalidating the return value of SB_GETTEXTLENGTH. You should review the Security Considerations: Microsoft Windows Controls before continuing.

This message returns a maximum of 65,535 characters. If the text string is longer than that, it is truncated.

If the text has the SBT_OWNERDRAW drawing type, this message returns the 32-bit value associated with the text instead of the length and operation type.

Normal windows display text left-to-right (LTR). Windows can be mirrored to display languages such as Hebrew or Arabic that read right-to-left (RTL). If SBT_RTLREADING is set, the lParam string reads in the opposite direction from the text in the parent window.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]



Unicode and ANSI names


See also




© 2016 Microsoft