WinApi Question (GetEnvironmentVariable)

Blitz3D Forums/Blitz3D Programming/WinApi Question (GetEnvironmentVariable)

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.

okay, just want to let you guys know that i solved the problem. (with the help of the search function on this board) :-) here's the source:

Function GetEnvVar$(VariableName$)
	TempBank = CreateBank(1)
	size = api_GetEnvironmentVariable%(VariableName$,TempBank,1)
	If size > 0 Then
		ResizeBank TempBank,Size+1
		api_GetEnvironmentVariable%(VariableName$,TempBank,Size+1)
	Else
		Return ""
	End If

	retstring$ = ""
	For t = 0 To BankSize(tempbank)-3
		retstring$ = retstring$ + Chr(PeekByte(tempbank,t))
	Next
		
	FreeBank tempbank
	Return retstring$
End Function