Note that there are some explanatory texts on larger screens.

plurals
  1. POWrite string variable to the clipboard
    primarykey
    data
    text
    <p>I'm going to admit, right off the bat, that I'm Pascal-inexperienced, to say the least. So, any help I can get will be greatly appreciated. :)</p> <p>As part of a larger program, I need to write a string variable to the clipboard. I've created a new project in Lazarus (version 1.0.12) so I can try to figure out how to do so without the complications caused by extra, unnecessary code, which I have included below:</p> <pre><code>program varToClipboard; uses Clipbrd; var textToCopy:string; begin textToCopy := 'Test text from Pascal'; Clipboard.AsText := textToCopy; end. </code></pre> <p>Using the above code, along with a required <code>LCLBase</code> dependency, I'm getting the following error in CMD when running the compiled EXE:</p> <pre><code>An unhandled exception occurred at $000000000043D45E : EAccessViolation : Access violation $000000000043D45E CLIPBOARDREGISTERFORMAT, line 98 of ./include/lclintf.inc $000000000043C35B PREDEFINEDCLIPBOARDFORMAT, line 185 of lclintf.pas $0000000000415B0C TCLIPBOARD__SETASTEXT, line 452 of ./include/clipbrd.inc $0000000000401802 main, line 12 of varToClipboard.lpr </code></pre> <p>According to <a href="http://wiki.freepascal.org/Clipboard" rel="nofollow">the documentation</a>, I seem to be doing everything right. Although, I have found the documentation to be... lacking on more than on occasion.</p> <p>&nbsp;</p> <p>Also, what do I have to do so that I can run the compiled EXE (which will just generate and write a string to the clipboard) without the console window popping up?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload