IonicWind Software

IWBasic => General Questions => Topic started by: billhsln on November 20, 2017, 05:41:28 PM

Title: Clipboard problem
Post by: billhsln on November 20, 2017, 05:41:28 PM
For work, I end up taking 2 rows in an Excel spread sheet and merging the text and then putting the merged text into on cell.  I would like to be able to copy it into the clipboard and then click on an IWB program  which will read the clipboard, merge the text with a blank if needed and then reload the merged text into the clipboard.

I have tried to start from one of the examples, but it does not seem to take the info from the clipboard.

I know I must be doing some thing wrong, but not sure where to start.

Thanks,
Bill

Title: Re: Clipboard problem
Post by: LarryMc on November 20, 2017, 11:51:38 PM
Are you reading the Excel spreadsheet with IWB and putting the cell info on the clipboard; or are you putting the cell info on the clipboard directly from within Excel?

If it is the latter then, as I understand it, it gets complicated because you can only have one "owner" of the clipboard at a time and messages would have to be sent back and forth between Excel and IWB while Excel is the owner and the IWB and Excel when IWB is the owner.

You can read here to see if you get the same idea:

https://msdn.microsoft.com/en-us/library/ms649012(v=vs.85).aspx
Title: Re: Clipboard problem
Post by: billhsln on November 21, 2017, 08:49:44 AM
I see, so what I am trying is much more complicated than I thought.  I was doing the copy directly from Excel, then switching over to my program and doing a Ctrl-V, which gave me back nothing.

Ok, will figure out another way to do it.

Thanks,
Bill
Title: Re: Clipboard problem
Post by: fasecero on November 21, 2017, 11:43:25 AM
QuoteI was doing the copy directly from Excel, then switching over to my program and doing a Ctrl-V, which gave me back nothing.

I think in this case your program should work with a few tweaks

DECLARE "user32",OpenClipboard(hwnd:WINDOW),INT

It needs to be changed to

DECLARE "user32",OpenClipboard(hwnd:INT),INT

then

OpenClipboard(w)

by

OpenClipboard(w.hwnd)

I'm not familiar with clipboard "ownership" so no idea when/how it can interfere with this code, though.