Clipboard MAV & pointer question.

Blitz3D Forums/Blitz3D Programming/Clipboard MAV & pointer question.

D4NM4N(Posted 2008) [#1]
Can someone try this code and see if it mavs on setclipboardtext()? The problem seems randomly occuring so it may work a few times before failing(In vista it seems to crash 100%).
Weird thing is, somethings changed (windows? blitz?) as im certain this was working fine before but its been a while since i used it. :/

Function WriteClipboardText(txt$)
	Local cb_TEXT=1
	If txt$="" Then Return 
	If api_OpenClipboard(0)
		api_EmptyClipboard()
		api_SetClipboardtext%(cb_TEXT,txt$)
		api_CloseClipboard()
	EndIf
End Function

;-----------------------------------

Function ReadClipboardText$()
	Local cb_TEXT=1
	Local txt$=""
	If api_OpenClipboard(0)
		If api_IsClipboardFormatAvailable(cb_TEXT) 
			txt$=api_GetClipboardtext$ (cb_TEXT)
		EndIf
		api_CloseClipboard()
	EndIf
	Return txt$
End Function

Needed Decls for user32.decl:
extra ones:
api_GetClipboardtext$ (cb_TEXT%): "GetClipboardData"
api_SetClipboardtext%(cb_TEXT%,txt$): "SetClipboardData"

originals:
api_GetClipboardData% (wFormat%) : "GetClipboardDataA"
api_SetClipboardData% (wFormat%, hMem%) : "SetClipboardDataA"
api_EmptyClipboard% () : "EmptyClipboard"
api_CloseClipboard% () : "CloseClipboard"



Wings(Posted 2008) [#2]
i think this is error

Local txt$=""


maby not sure how big is the string.. this is interesting indeed :)


Wings(Posted 2008) [#3]
extra ones:
api_GetClipboardtext$

why is there a $ instead of a %


öh ?


markcw(Posted 2008) [#4]
Maybe the decl $ method is buggy and getting the string 'properly' would fix it. Not volunteering though.