Gets information about the operating system, processor, and screen display of the system.
GetEnvironment ( environmentinfo )
Argument |
Description |
---|---|
environmentinfo |
The name of the Environment object that will hold the information about the environment |
Integer. Returns 1 if it succeeds and -1 if an error occurs. If environmentinfo is null, GetEnvironment returns null.
In cross-platform development projects, you can call GetEnvironment in scripts and take actions based on the operating system. You can also find out the processor (Intel 386 or 486, 68000, and so on). The information also includes version numbers of the operating system and PocketBuilder.
You can call GetEnvironment to find out the number of colors supported by the system and the size of the screen. You can use the size information in a window’s Open script to reset its X and Y properties.
This script runs another PocketBuilder application and uses the OSType property of the Environment object to determine how to specify the path:
string path
environment env
integer rtn
rtn = GetEnvironment(env)
IF rtn <> 1 THEN RETURN
CHOOSE CASE env.OSType
CASE Windows!, WindowsNT!
path = "C:\PB_apps\analyze.exe"
CASE WindowsCE!
path = "\windows\analyze.exe"
CASE ELSE
RETURN
END CHOOSE
Run(path)
This example displays a message box that shows the major, minor, and fixes versions of PocketBuilder:
string ls_version environment env integer rtn rtn = GetEnvironment(env) IF rtn <> 1 THEN RETURN ls_version = "Version: "+ string(env.pbmajorrevision) ls_version += "." + string(env.pbminorrevision) ls_version += "." + string(env.pbfixesrevision) ls_version += " Build: " + string(env.pbbuildnumber) MessageBox("PocketBuilder Version", ls_version)