[Overview][Types][Classes][Procedures and functions][Index] Reference for unit 'Clipbrd' (#lcl)

TClipboard.GetTextBuf

Reads text from the clipboard and returns the content and number of characters.

Declaration

Source position: clipbrd.pp line 213

public function TClipboard.GetTextBuf(

  Buffer: PChar;

  BufSize: Integer

):Integer;

Arguments

Buffer

  

Pointer to the buffer where the text read from the clipboard is stored.

BufSize

  

Number of characters requested from the clipboard.

Function result

Number of characters stored in the Buffer argument in the method.

Description

GetTextBuf is method used to retrieve text stored in the clipboard and store it in the Buffer argument. Buffer cannot be Nil, and must be large enough to store the number of characters requested in the BufSize argument.

No actions are performed in the method if Buffer is unassigned or BufSize is set to 0.

GetTextBuf use a temporary TMemoryStream instance to load the content from the text clipboard format, and to store the content to the specified buffer. Buffer is terminated with a #0 (NUL) character to indicate the end of the data in the buffer.

The return value is set to the number characters read from the buffer, or the number of characters available for the clipboard format when it differs from the requested size. It is set to 0 (zero) if no data was available on the clipboard.

Use the AsText property to retrieve the clipboard content as a String value.


Version 4.0 Generated 2025-05-03 Home