PLATFORM PROPERTIES

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11 (Modified)


PLATFORM PROPERTIES (platform{; system{; processor{; language}}})

ParameterTypeDescription
platformNumber2 = Mac OS, 3 = Windows
systemNumberDepends on the version you are running
processorNumberProcessor family
languageNumberDepends on the system you are using

Description

The PLATFORM PROPERTIES command returns information about the type of operating system you are running, the version and the language of the operating system, and the processor installed on your machine.

PLATFORM PROPERTIES returns environment information in the platform, system, processor and language parameters.

platform indicates the operating system used. This parameter returns one the following predefined constants:

ConstantTypeValue
Mac OSLong Integer2
WindowsLong Integer3

The information returned in system depends on the version of 4D you are running.

Macintosh version

If you are running a Mac OS version of 4D, the system parameter returns a 32-bit (Long Integer) value, for which the high level word is unused and the low level word is structured like this:

- The high byte contains the major version number,

- The low byte is composed of two nibbles (4 bits each). The high nibble is the major update version number and the low nibble is the minor update version. Example: System 9.0.4 is coded as $0904, so you receive the decimal value 2308.

Note: In 4D, you can extract these values using the % (modulo) and \ (integer division) numeric operators or the Bitwise operators.

Use the following formula to find out the Mac OS main version number:

   PLATFORM PROPERTIES($vlPlatform;$vlSystem)
   $vlResult:=$vlSystem\256
      `If $vlResult = 8  --> you are under Mac OS 8.x
      `If $vlResult = 9  --> you are under Mac OS 9.x
      `If $vlResult = 16  --> you are under Mac OS 10.x

Windows version

If you are running the Windows version of 4D, the system parameter returns a 32-bit (Long Integer) value, the bits and bytes of which are structured as follows:

If the high level bit is set to 0, it means you are running Windows NT, Windows 2000, Windows XP or Windows Vista. If the bit is set to 1, it means you are running Windows 95 or Windows 98 (both obsolete).

Note: The high level bit fixes the sign of the long integer value. Therefore, in 4D, you just need to test the sign of the value; if it is positive you are running Windows NT, Windows 2000, Windows XP or Windows Vista. You can also use the Bitwise operators.

The low byte gives the major Windows version number. If it returns 4, you are running Windows 95, 98 or Windows NT 4. If it returns 5, you are running Windows 2000 or Windows XP (in both cases, the sign of the value tells whether or not you are running NT/2000). If it returns 6, you are running Windows Vista..

The next low byte gives the minor Windows version number. If you are running Windows 95, this value is 0.

Note: In 4D, you can extract these values using the % (modulo) and \ (integer division) numeric operators or the Bitwise operators.

The processor parameter indicates the microprocessor "family" of the machine. Two values can be returned, available in the form of constants:

ConstantTypeValue
Intel CompatibleLong Integer 586
Power PCLong Integer 406

The combination of the platform and processor parameters can be used for example to know without ambiguity whether the machine used is of the "MacIntel" type (platform=Mac OS and processor=Intel Compatible).

The language parameter is used to find out the current language of the system on which the database is running. Here is a list of the codes that can be returned in this parameter, as well as their meanings:

CodeLanguage
1Arabic
2Bulgarian
3Catalan
4Chinese
5Czech
6Danish
7German
8Greek
9English
10Spanish
11Finnish
12French
13Hebrew
14Hungarian
15Icelandic
16Italian
17Japanese
18Korean
19Dutch
20Norwegian
21Polish
22Portuguese
24Romanian
25Russian
26Croatian
26Serbian
27Slovak
28Albanian
29Swedish
30Thai
31Turkish
33Indonesian
34Ukrainian
35Belarusian
36Slovenian
37Estonian
38Latvian
39Lithuanian
41Farsi
42Vietnamese
45Basque
54Afrikaans
56Faeroese

Note: If the command is not able to identify the system language, the value 9 (English) is returned.

Example

The following project method displays an alert box showing the OS software you are using:

      ` SHOW OS VERSION project method

   PLATFORM PROPERTIES($vlPlatform;$vlSystem;$vlMachine)
   If (($vlPlatform<2) | ($vlPlatform>3))
      $vsPlatformOS:=""
   Else 
      If ($vlPlatform=Windows)
         $vsPlatformOS:=""
         If ($vlSystem<0)
            $winMajVers:=((2^31)+$vlSystem)%256
            $winMinVers:=(((2^31)+$vlSystem)\256)%256
            If ($winMinVers=0)
               $vsPlatformOS:="Windows™ 95"
            Else
               $vsPlatformOS:="Windows™ 98"
            End if
         Else 
            $winMajVers:=$vlSystem%256
            $winMinVers:=($vlSystem\256)%256
            Case of
               : ($winMajVers=4)
                  $vsPlatformOS:="Windows™ NT"
               : ($winMajVers=5)
                  If ($winMinVers=0)
                     $vsPlatformOS:="Windows™ 2000"
                  Else
                     $vsPlatformOS:="Windows™ XP"
                  End if
               : ($winMajVers=6)
                  $vsPlatformOS:="Windows™ Vista"

            End case
         End if 
         $vsPlatformOS:=$vsPlatformOS+" version "+String($winMajVers)+"."+String($winMinVers)
      Else 
         $vsPlatformOS:="Mac OS™ version "
         If (($vlSystem\256) = 16)
            $vsPlatformOS:=$vsPlatformOS+"10"
         Else
            $vsPlatformOS:=$vsPlatformOS+String($vlSystem\256)
         End if
         $vsPlatformOS:=$vsPlatformOS+"."+String(($vlSystem\16)%16)+(("."+String($vlSystem%16))
                                                *Num(($vlSystem%16) # 0))
      End if 
   End if 
   ALERT($vsPlatformOS)

On Windows, you get an alert box similar to this:

On Macintosh, you get an alert box similar to this:

See Also

Bitwise Operators.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next