blitzget issues..

BlitzPlus Forums/BlitzPlus Programming/blitzget issues..

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hmm .. there is an API called SHGetFolderPathA, with which you can obtain certain other folders in Windows.
You need to put a 'decls' file in the programfiles\blitz\userlibs folder.

You can maybe try this code, but I'm not sure if it finds the right directory. Also, I didn't test if it can delete files from that directory with DeleteFile.
;Save these lines as a textfile in the directory c:\program files\blitz3d\userlibs
;and call the file 'shell32.decls'
;-------------------------------------
;.lib "shell32.dll"

;api_GetFolderPath%(hwnd, p1, p2, p3, out*) : "SHGetFolderPathA"
;-------------------------------------
;it will enable the api_getfolderpath command


	Graphics 800, 600, 0, 2
	
	ok$ = GetInternetTempFolder$()
	
	dir = ReadDir(ok$)
	
	Repeat

		;get next file in folder	
		f$ = NextFile$(dir)
		
		;if no more files are found, exit loop
		If f$ = "" Then Exit

		;test if a file is found (else it is a subfolder)
		If FileType(ok$ + f$) = 1 Then		
		
			;print name that was found
			Print f$
			
			;ask for delete
			If Lower$(Input$("delete ?")) = "y" Then 
				;print complete filename
				Print ok$ + f$
				;delete file
				DeleteFile ok$ + f$

				;test if file exists
				If FileType(ok$ + f$) <> 1 Then Print "file was deleted"
				
			End If
		End If
	
	Forever
	
	WaitKey()	
	End

;-------------------------------------------------------------------------------------------------------
;											GetMyDocumentsPath()
;-------------------------------------------------------------------------------------------------------
;uses SHGetFolderPathA to get the mydocuments folder
Function GetInternetTempFolder$()

	bank = CreateBank(256)
	
	api_GetFolderPath(0, $20, 0, 0, bank)
	
	s$ = ""
	For i = 0 To 255
		b = PeekByte(bank, i)
		If b = 0 Then Exit
		s$ = s$ + Chr$(b)
	Next
	
	FreeBank bank
	
	If Right$(s$, 1) <> "" Then s$ = s$ + ""
	
	Return s$
	
End Function