KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Determining detailed Operating System details
PRODUCT: 4D | VERSION: 11.5 | PLATFORM: Mac & Win
Published On: January 15, 2010
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In the documentation to the 4D command PLATFORM PROPERTIES, there is sample code that shows how to decode detailed knowledge to what platform a 4D application is running on. This could be very important debugging information. With the introduction of new Windows 7™ OS the example code needs updating.

Replacing the appropriate lines of code with the snippet of code provided below will allow you to detect just what version of the Windows OS the target machine is running. However, there are limitations with the code. It is possible that a machine could be running Windows™ Server 2008. The same values are produced from the code provided by this method for Windows Server 2008 and Vista or 7, depending on the revision of Windows™ Server 2008.

The code snippet shown below reflects all of these potential situations:

...
            : ($WinMajVers_L=5)
               Case of
                  : ($WinMinVers_L=0)
                     $PlatformOS_T:="Windows™ 2000"
                  : ($WinMinVers_L=1)
                     $PlatformOS_T:="Windows™ XP"
                  : ($WinMinVers_L=2)
                     $PlatformOS_T:="Windows™ Server 2003 or Windows™ Server 2003 R2"
                  Else
                     $PlatformOS_T:="Windows™ (Unknown)"
               End case

            : ($WinMajVers_L=6)
               Case of
                  : ($WinMinVers_L=0)
                     $PlatformOS_T:="Windows™ Vista or Windows™ Server 2008"
                  : ($WinMinVers_L=1)
                     $PlatformOS_T:="Windows™ 7 or Windows™ Server 2008 R2"
                  Else
                     $PlatformOS_T:="Windows™ (Unknown)"
               End case
         End case

      End if
...