#include once "window9.bi"

Function GetClipBoardFile() As USTRING Export
	Dim Handle as Handle
	dim sRet As USTRING
	dim i As Integer, numFiles As Integer
	#ifdef UNICODE
		dim buffer As wString*MAX_PATH
	#else	
		dim buffer As ZString*MAX_PATH
	#EndIf
	If IsClipboardFormatAvailable(CF_HDROP) = 0 Then return sRet
	If OpenClipboard(0) = 0 Then return sRet
	Handle = Cast(DROPFILES Ptr,GetClipboardData(CF_HDROP))
	if Handle <> 0 then
		numFiles = DragQueryFile(Handle, &hFFFFFFFF, 0, 0)
		for i = 0 to numfiles - 1
			DragQueryFile(Handle, i, @buffer, SizeOf(buffer))
			#ifdef UNICODE
				sRet = sRet & buffer & "|" 
			#else	
				sRet = sRet & buffer & Chr(0) 
			#EndIf
		Next
		CloseClipboard()
	endif
	#ifdef UNICODE
		sRet = sRet & "|" 
	#else	
		sRet = sRet & Chr(0) 
	#EndIf
	Return sRet
End Function
