KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Detecting if the OS is 64 bit or 32 bit
PRODUCT: 4D | VERSION: 12.1 | PLATFORM: Win
Published On: February 4, 2011

Here is a method that can be used to detect if the OS is a 64 bit or 32 bit OS.

C_BOOLEAN($0)
C_TEXT($in;$out;$err)
SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true")
LAUNCH EXTERNAL PROCESS("cmd.exe /C set | findstr ProgramFiles(x86)";$in;$out;$err)
If(Position("ProgramFiles(x86)";$out)=0)
     // x86 variable not found
  $0:=False
Else
     // x86 variable found
  $0:=True
End if


If the method is saved as UTIL_isOS64bit it could be used like this:

If(UTIL_isOS64bit)
    // do something for 64 bit OS only
End if