I agree, right off the bat, that I am Pascal - inexperienced, to say the least. So any help I can get would be very appreciated. :)
As part of a larger program, I need to write a string variable to the clipboard. I created a new project in Lazarus (version 1.0.12), so I can try to figure out how to do this without the complications caused by the extra unnecessary code that I included below:
program varToClipboard; uses Clipbrd; var textToCopy:string; begin textToCopy := 'Test text from Pascal'; Clipboard.AsText := textToCopy; end.
Using the above code along with the required LCLBase dependency, I get the following error in CMD when running the compiled EXE:
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
According to the documentation , I seem to be doing everything right. Although, I found that the documentation ... is missing more than ever.
Also, what do I need to do so that I can run the compiled EXE (which will just generate and write the string to the clipboard) without the console window appearing?
source share