From QB64 Wiki

Jump to: navigation, search

The _CLIPBOARD$ function returns the current Operating System's clipboard contents as a STRING.


result$ = _CLIPBOARD$


  • Text returned can contain the entire contents of a copied file or web page.
  • The string returned can also contain formatting like CRLF (CHR$(13) + CHR$(10)) end of line characters.
  • The clipboard can be used to copy, paste and communicate between running programs.

Example: Passing a string value between two running programs no matter where they are located.


PRINT "Start Program2 to read your text entries! Empty entry quits!" _CLIPBOARD$ = "Entry program started!" 'set clipboard initially DO LINE INPUT "Enter some text to send to other program: ", text$ IF text$ = "" THEN EXIT DO _CLIPBOARD$ = text$ LOOP SYSTEM


PRINT "Enter text in Program1 and this program will read it. Esc key quits!" DO text$ = _CLIPBOARD$ 'function returns clipboard contents IF LEN(text$) THEN PRINT text$ _CLIPBOARD$ = "" 'clear clipboard after a read END IF LOOP UNTIL INKEY$ = CHR$(27) END

Explanation: Compile and run both programs at once to see the interaction. You could also run them on different paths.

See also:

  • _CLIPBOARD$ (statement)

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Personal tools
  • Log in
  • What links here
  • Related changes
  • Special pages
  • Printable version