guides:programming:programmers_reference_manual:setdata_method_clipboard

SETDATA method (Clipboard)

Places data on the clipboard in the specified format.

SuccessFlag = Exec_Method( "CLIPBOARD", 
                           "SETDATA",   
                           FormatName,  
                           ClipData )
 
NameRequiredDescription
FormatNameYesName of the format to mark the data as. This can be one of the common formats listed below (pass as a literal string), or a custom format (can be any string)

• CF_TEXT
• CF_BITMAP
• CF_METAFILEPICT
• CF_SYLK
• CF_DIF
• CF_TIFF
• CF_OEMTEXT
• CF_DIB
• CF_PALETTE
• CF_PENDATA
• CF_RIFF
• CF_WAVE
• CF_UNICODETEXT
• CF_ENHMETAFILE
• CF_HDROP
• CF_LOCALE
• CF_DIBV5

TRUE$ if the data was set on the clipboard successfully, or FALSE$ otherwise.

The SETDATA method can be called multiple times to set the data in different formats on the clipboard.

This is basically a wrapper around the SetClipboardData Windows API function, so it is worth examining at the documentation for this on the MSDN website to get a better idea of the capabilities of this method.

 
// CLIPBOARD SETDATA example

   //

   // Set some html data and a text version

   

   Declare Function Str_Unicode

   

   FormatID = "text/html"

   ClipData = "<b>HTML<b> text <i>to</i> set."

   

   Call Exec_Method( "CLIPBOARD", "SETDATA", FormatID, ClipData )

   

   // Set the text as Unicode text

   FormatID = "CF_UNICODETEXT"

   ClipData = Str_Unicode( "Text to set" )

   

   Call Exec_Method( "CLIPBOARD", "SETDATA", FormatID, ClipData )
 
 
 

FORMATLIST property, TEXT property, GETDATA method.

  • guides/programming/programmers_reference_manual/setdata_method_clipboard.txt
  • Last modified: 2023/10/25 10:50
  • by 127.0.0.1