From RAD Studio API Documentation
Jump to: navigation, search


function GetTextBuf(Buffer: PChar; BufSize: Integer): Integer;


int __fastcall GetTextBuf(System::WideChar * Buffer, int BufSize);


Type Visibility Source Unit Parent
function public
Vcl.Controls TControl


Retrieves the control's text, copies it into a buffer, and returns the number of characters copied.

Call GetTextBuf to retrieve the text of a control into a fixed size buffer. The text copied is the value of the Text property. GetTextBuf returns the number of characters that were actually copied, which is either the length of the Text property, or BufSize - 1, whichever is smaller.

To find out how many characters the buffer needs to hold the entire text, call the GetTextLen method before allocating a buffer for GetTextBuf.

Note: GetTextBuf is available for compatibility with 16-bit code. Where backward compatibility is not an issue, use the Text property.

Note: To obtain the control's text as an AnsiString, use the Text property instead.

See Also

Code Examples