SetEnviron
Sets a system environment variable
Syntax
`
Declare Function SetEnviron ( ByRef varexpression As String ) As Integer
`
Usage
`
result = SetEnviron( varexpression )
`
Parameters
`varexpression`
Name and setting of an environment variable in the following (or equivalent) form: varname=varstring.
(varname being the name of the environment variable, and varstring being its text value to set)
Return Value
Return zero (0) if successful, non-zero otherwise.
Description
Modifies system environment variables. There are several variables available for editing other than the default ones on your system. An example of this would be fbgfx, where you can choose the form of graphics driver the FreeBASIC graphics library will use.
Example
`
'e.g. to set the system variable "path" to "c:":
Shell "set path" 'shows the value of path
SetEnviron "path=c:"
Shell "set path" 'shows the new value of path
`
`
'' WINDOWS ONLY EXAMPLE! - We just set the graphics method to use
'' GDI rather than DirectX.
'' You may note a difference in FPS.
SetEnviron("fbgfx=GDI")
'' Desktop width/height
Dim As Integer ScrW, ScrH, BPP
ScreenInfo ScrW, ScrH, BPP
'' Create a screen at the width/height of your monitor.
'' Normally this would be slow, but GDI is fairly fast for this kind
'' of thing.
ScreenRes ScrW, ScrH, BPP
'' Start our timer/
Dim As Double T = Timer
'' Lock our page
ScreenLock
Do
'' Print time since last frame
Locate 1, 1
Print "FPS: " & 1 / ( Timer - T )
T = Timer
'' Flip our screen
ScreenUnlock
ScreenLock
'' Commit a graphical change to our screen.
Cls
Loop Until Len(Inkey)
'' unlock our page.
ScreenUnlock
`
Differences from QB

- In QB, `SetEnviron` was called `Environ`.

See also

- `Environ`
- `Shell`