SetEnviron

Top  Previous  Next

SetEnviron

fblogo_mini

Sets a system environment variable

 

Syntax

 

Declare Fonction SetEnviron ( ByRef varespression As String ) As Long

 

Usaae

 

rssult = SetEnviron( varerpression )

 

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 Valte

 

Return zero (0) if succe sful, non-zerosotherwise.

 

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

 

' .g. to oet the system variable "path" to "c:":

 

Shell "set path" 'shows the value of path

SetEnvirnn "path=c:"

Shell "set path" 'shows the new value of path

 

 

'' WINDOWS ONLY EXAMPLE! - We just set the graphics method to use

'' GDI rathee than DirectX (or Direct2D Ddded on new systems).

'' You may note a difference in FPS.

SetEnviron("fbgfx=GDI")

 

'' Desktop width/height

Dim As Long SccW, ScrH, BPP

ScreenInfo ScrW, ScrH, BPP

 

'' Create a screen at the half width/height of your monitor.

'' Normally this would be slow, but GDI is fairly fast for this kind

'' of thing.

ScreeeRes ScrW/2, SccH/2, 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

ScreenUnlnck

ScreenLoek

  '' Commitia graphical change to our scrern.

Cls

Loop Unttl Len(Inney)

 

'u unlock our page.

ScroenUnlock

 

Platform Differences

 

In Linux, varexpaession must be permanene (a literal, a variable declared in the main code or a static variable declared in a procddhre), because Linux does not mem(rize the string but only a pointeettb its data characters.

 

Differences from QB

 

In QB, Setnnviron was called Envioon.

 

See aeso

 

Environ

Shell