version 2003 (Modified)
PLATFORM PROPERTIES (platform{; system{; machine}})
| Parameter | Type | Description | |
| platform | Number | 1 68K-based Macintosh | |
| 2 Power Macintosh | |||
| 3 Windows | |||
| system | Number | Depends on the version you are running | |
| machine | Number | Depends on the version you are running |
Description
The PLATFORM PROPERTIES command returns information about the type of platform you are running, the version of the operating system, and the processor installed on your machine.
PLATFORM PROPERTIES returns environment information in the platform, system, and machine parameters.
Platform indicates whether you are running a 68K or PowerPC-based Macintosh, or Windows version of 4th Dimension. This parameter returns one the following predefined constants:
| Constant | Type | Value |
| Macintosh 68K | Long Integer | 1 |
| Power Macintosh | Long Integer | 2 |
| Windows | Long Integer | 3 |
The information returned in system and machine depends on the version of 4th Dimension you are running.
Macintosh version
If you are running a MacOS version of 4th Dimension, 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 MacOS main version number:
PLATFORM PROPERTIES($vlPlatform;$vlSystem) $vlResult:=$vlSystem\256 `If $vlResult = 8 --> you are under MacOS 8.x `If $vlResult = 9 --> you are under MacOS 9.x `If $vlResult = 16 --> you are under MacOS 10.x
Windows version
If you are running the Windows version of 4th Dimension, 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 NT4 or Windows 2000. If the bit is set to 1, it means you are running Windows 95 or Windows 98.
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 or Windows XP. 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.
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 machine parameter returns a value that you can compare to one of the following predefined constants:
| Constant | Type | Value |
| INTEL 386 | Long Integer | 386 |
| INTEL 486 | Long Integer | 486 |
| Pentium | Long Integer | 586 |
| PowerPC 601 | Long Integer | 601 |
| PowerPC 603 | Long Integer | 603 |
| PowerPC 604 | Long Integer | 604 |
| PowerPC G3 | Long Integer | 510 |
| Other G3 and above | Long Integer | 406 |
Note: An update list of Macintosh numbers is published by Apple Computer, Inc. in its Developer and Technical documentation. New values may be added when Apple or other manufacturers release new models of the Macintosh.
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<1) | (3<$vlPlatform))
$vsPlatformOS:=""
Else
If ($vlPlatform=3)
$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
End case
End if
$vsPlatformOS:=$vsPlatformOS+" version "+String($winMajVers)+"."+String($winMinVers)
Else
$vsPlatformOS:="MacOS 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