titre_site.jpg (51607 octets)

Tester la configuration 64 bits

La commande OS() de dBase ne permet pas de savoir si XP, Vista ou 7 sont en version 64 bits.

Pour le savoir, avec un windows au moins XP SP2, il suffit d'exécuter ce code :

function is64Bit()

local lWow64,l64Bit

lWow64 = false
l64Bit = false

if type("GetCurrentProcess") # "FP"
   extern chandle GetCurrentProcess(cvoid) kernel32
endif

try
   if type([IsWow64Process]) # [FP]
      extern CLOGICAL IsWow64Process(chandle,cptr clogical) kernel32
   endif
catch (exception e)
endtry

try
   if IsWow64Process(GetCurrentProcess(),lWow64) // Test pour 64 bits
      l64Bit := lWow64
   endif
catch (exception e)
endtry

return (l64Bit)

Source :
From: "Andrew Shimmin"
Newsgroups: dbase.programming
Sent: Saturday, October 29, 2011 4:42 AM
Subject: Re: OS() for Win 7 64bit

Ce code fonctionne donc sur les versions 32 bits et retourne false.

La fonction IsWow64Process ne fonctionne qu'à partir de XP Service Pack 2 ou Windows Server 2003 avec SP1

 

D'autres moyens sont possibles :

//----- Save as WMI_getOS.prg -----
Function WMI_getOS()

// The function returns the operating system Name and Architecture
// Usage: ? WMI_getOS() // Result: Microsoft Windows 8 Pro 64-bit
// Author: Ivar B. Jessen
// Date: 03-09-2013


objLocator = new OleAutoClient("WbemScripting.SWbemLocator")
objWMI = objLocator.ConnectServer(".", "root\cimv2")
collItems = objWMI.ExecQuery([Select * from Win32_OperatingSystem])

return collItems.ItemIndex(0).Caption + " " + collItems.ItemIndex(0).OSArchitecture
//-----
Source :Sujet : Re: 32 or 64 bit
Date : Tue, 03 Sep 2013 19:48:33 +0200
Auteur : Ivar B. Jessen <nospam@nospam.com>
Distribution : dbase.programming

ou

? is64Bit()

function is64Bit
  // Rich... www.autotraker.com
   try
   OSArchitecture = new
OleAutoClient("WbemScripting.SWbemLocator").ConnectServer(".",
"root\cimv2").ExecQuery( [select * from
Win32_OperatingSystem] )[0].OSArchitecture
   catch(exception e)
    OSArchitecture = ""
   endtry
   return ("x64"$OSArchitecture or "AMD64"$OSArchitecture or "64-bit"$OSArchitecture)
Source : Sujet : Re: 32 or 64 bit
Date : Tue, 3 Sep 2013 14:13:32 -0400
Auteur : "Rich..."
Distribution : dbase.programming

 

Sur le site de Bernard Mouille vous trouverez aussi le code pour tester, même sur des versions antérieures à xp SP2 : img_bm.jpg (1390 octets)

retour

sources  :

La fonction windows sur msdn.microsoft : IsWow64Process

 

Revenir à l'aide