Following the recomedations found in the MSKB Article:
How to check for MDAC Version? "MDAC Version: " + NVL(GetMDACVersion(),"Not installed")
FUNCTION GetMDACVersion
LOCAL lcRetValue
lcRetValue = .NULL.
#DEFINE HKEY_LOCAL_MACHINE -2147483646
TRY
oReg = NEWOBJECT("registry",HOME(1)+"ffc\registry.vcx")
lcKey = "Software\Microsoft\DataAccess"
IF oReg.OpenKey(lcKey,HKEY_LOCAL_MACHINE,.F.) = 0
lcSubKey = "Version" &&Or "FullInstallVer"
IF oReg.GetKeyValue(lcSubKey,@lcRetValue) # 0
lcRetValue = .NULL.
ENDIF
oReg.CloseKey()
ENDIF
CATCH TO oError
lcRetValue = .NULL.
FINALLY
RELEASE oReg
ENDTRY
RETURN lcRetValue
ENDFUNC
This code was a reply in a thread at the microsoft newsgroup of visual foxpro (spanish edition), it was also published at PortalFox.com, Luis María Guayán incorpore another solutions based at API calls (mine also has), the difference with my implementation was in the fact it was based on the use of OOP paradigm and using the Fox Foundation Classes.
--- Detectar si MDAC está instalado y qué versión (spanish) ---
http://www.portalfox.com/article.php?sid=1631
----------------------------
Espartaco Palma
SysOp www.PortalFox.com
México D.F.