Clipboard problem

BlitzPlus Forums/BlitzPlus Programming/Clipboard problem

Andres(Posted 2007) [#1]
I have this Function:
Function SetClipboardText(clipboard$ = "")
	If api_OpenClipboard(0)
		bank% = CreateBank(Len(clipboard$))
		For i = 1 To Len(clipboard$)
			PokeByte(bank%, (i - 1), Asc(Mid$(clipboard$, i, 1)))
		Next
		api_EmptyClipboard()
		api_SetClipboardData(1, bank%) ; $01
		api_CloseClipboard()
		FreeBank bank%
	Else
		Notify "Failed to copy text to clipboard!"
	EndIf
End Function


Here I call the function:
this.results = Selectedfile.results()
SetClipboardText(this\link$)


Somehow it appends some not wanted text to the clipboard.
Clipboard$ is equal to this\link$.
I fetch the info from HTTP server and I separate the sectors (link, name, description etc), but some of the sectors are added to the clipboard (Name for example). Can anyone tell why?

Decls: api_SetClipboardData% (wFormat%, hMem*)

Does it have something to do with memory addresses?

EDIT:
Problem solved!

Decls: api_SetClipboardData% (wFormat%, hMem$) : "SetClipboardData"

Function SetClipboardText(clipboard$ = "")
	If api_OpenClipboard(0)
		api_EmptyClipboard()
		api_SetClipboardData(1, clipboard$)
		api_CloseClipboard()
	Else
		Notify "Failed to copy text to clipboard!"
	EndIf
End Function