Using clipboard to copy text to Notepad
Posted: Fri Apr 03, 2020 8:23 am
I have done some quick code that I thought would just work, but for some reason it doesn't.
The Get_Report_As_Text() does return lines of text with carriage return + linefeed line endings (I checked that).
But when I run it and after the alert appears I go to my Notepad window and paste and instead of the text I was expecting I get some bit of code I copied earlier in the day.
Can anyone see anything wrong? Or am I wrong in assuming that the Xbase++ clipboard can be used by other Windows programs?
Code: Select all
cText := Get_Report_As_Text()
oClipBoard := XbpClipboard():new():create()
oClipBoard:open()
oClipBoard:setBuffer(cText,XBPCLPBRD_TEXT)
if oClipBoard:getBuffer(XBPCLPBRD_TEXT) == cText
lOk:=.t.
endif
oClipBoard:close()
oClipBoard:destroy()
my_alert("Text "+iif(lOk,"","cannot be ")+"copied to clipboard"+iif(lOk," Ok",""))
But when I run it and after the alert appears I go to my Notepad window and paste and instead of the text I was expecting I get some bit of code I copied earlier in the day.
Can anyone see anything wrong? Or am I wrong in assuming that the Xbase++ clipboard can be used by other Windows programs?