Read ODBC Registry Values

File: ...\Samples\Solution\WINAPI\Regodbc.scx

This sample shows how to access the Windows Registry using the native Visual FoxPro DECLARE-DLL command. The Windows API provides a number of functions you can use to access, read and write to the registry. The Registry.prg class library in ...\Samples\Classes contains a class definition that exposes these functions as methods that you can call in your applications.

The Registry contains a listing of all installed ODBC drivers and data sources. If your application relies on using ODBC, then you might want to perform a Registry check to see if a particular driver or data source is installed. This sample shows how to query for ODBC information.

LOCAL oReg,regfile,nErrNum,lDrivers
PUBLIC aODBCData

regfile = HOME(2)+"classes\registry.prg"
SET PROCEDURE TO (m.regfile) ADDITIVE

oReg = CreateObject("ODBCReg")

DIMENSION aODBCData[1]
m.nErrNum = oReg.GetODBCDrvrs(@aODBCData)

See Also

Registry Access | ODBC Registry | Solutions Sample Overview | Visual FoxPro Foundation Classes A-Z