BBC BASIC for Windows
« Clipboard »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:56pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Clipboard  (Read 321 times)
KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Clipboard
« Thread started on: Jun 2nd, 2016, 10:00am »

I'm having a problem with the clipboard, so if anyone has any experience, I'd be grateful.

Based on the various programs in the Help and the Wiki I have written this code:

size%=SUMLEN(line$())
SYS"GlobalAlloc",&2000,size%*2TOhdata%
SYS"GlobalLock",hdata%TOP%
FORi%=0TO6
line$(i%)+=CHR$13+CHR$10
$$P%=line$(i%)
P%+=LENline$(i%)
NEXT
?P%=0:P%?1=0
SYS "GlobalUnlock",hdata%
SYS "OpenClipboard",@hwnd%
SYS "EmptyClipboard"
SYS "SetClipboardData",1,hdata%
SYS "CloseClipboard"

There are precisely 7 lines (0-6) and they all end up in hdata% - I've checked. However when I do Ctrl+V only the first line comes out of the clipboard.

Incidentally - and it may be completely irrelevant - if I add all the lines together by omitting the cr and lf characters, only about 250 characters are displayed, not the 65,000+ mentioned in the Help file.
User IP Logged

Zaphod
Guest
xx Re: Clipboard
« Reply #1 on: Jun 2nd, 2016, 3:20pm »

That code works for me.
You have some extra nulls at the end of the string that aren't needed: the $$ put a null at the end of the string.

I suggest that the issue may be the place you are trying to paste to does not accept that multi-line data. Paste to Notepad should work if it is plain text.
User IP Logged

KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Re: Clipboard
« Reply #2 on: Jun 6th, 2016, 7:42pm »

Thanks so much. Of course! Yes, it works just fine in Notepad - I was attempting to paste it into the output window from BB4W.

I was too stupid to try pasting it elsewhere. One day I'll be a real programmer!
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls