cut/copy/paste into external application?

Blitz3D Forums/Blitz3D Programming/cut/copy/paste into external application?

vivaigiochi(Posted 2010) [#1]
I need to save some string to use cut/copy/paste into external application. need only for so windows.


Charrua(Posted 2010) [#2]
see:
http://blitzbasic.com/Community/posts.php?topic=36419#398617

it may help

Juan


NewtSoup(Posted 2010) [#3]
Doesn't appear to work, at least not in Vista

First of all not all the decls are there.

tried adding
SetClipboardText(flags%,t$) : "SetClipboardText"
ExamineClipboard%(flags%) : "IsClipboardFormatAvailable"
GetClipboardText$(flags%) : "GetClipboardText"

to my use32.decls but it just tells me the functions don't exist.

tried an alternate way:

GMEM_MOVEABLE=$0002
GMEM_DDESHARE=$2000
CF_TEXT=1

t$="Quick Brown Fox Jumps Over The Lazy Dog"

OpenClipboard(0)
sz=Len(t$)+1

bText=CreateBank(sz)
For i=0 To sz-2
	PokeByte (bText,i,Asc(Mid(t$,i+1,1)))
Next
PokeByte btext,f,0

hTemp= GlobalAlloc(GMEM_MOVEABLE+GMEM_DDESHARE, sz)

pTemp=GlobalLock(hTemp)
apiRtlMoveMemory (pTemp,BLZPeekInt(bText+4),sz)
;apiRtlMoveMemory(ptemp,bText,sz)
EmptyClipboard()
SetClipboardData(CF_TEXT,hTemp)

CloseClipboard()

WaitKey


But this just results in garbage being posted to the clipboard and causes blitzcc to hang or hang and MAV whichever way you use apiRtlMoveMemory


Charrua(Posted 2010) [#4]
hi, there are some decls misspellings
but, with some corrections, it work correctly on xp, but, once again, on my "Vista home basic" the write function generates a mav (most of the times)

ANOTHER API CALL THAT WORK'S PERFECT ON XP, AND GENERATES A MAV ON VISTA!!!

i don't know why



Juan


jfk EO-11110(Posted 2010) [#5]
Maybe try:

api_SetClipboardData(CF_TEXT,txt$ + chr$(0) )

Just a guess.


Charrua(Posted 2010) [#6]
nope!

i test the code on an xp sp3 machine, and runing a Virtual Box machine with XP under vista and works perfectly ok, but, when i run the same .bb under vista, the write function generates a mav or an abnormal program termitation.

Read always work fine.

Juan