#include "registry.h" ** class in vfp9 samples directory SET PROCEDURE TO HOME(2) + "classes\registry.prg" * oOdbcReg to get odbc info, oReg to do general registry LOCAL oOdbcReg as OdbcReg, oReg as Registry ** set up some working arrays and variables LOCAL ARRAY aAll[1], aSome[1], aDsn[1] LOCAL lnCount, lnInc, llOk, lcVal CLEAR ** odbc specific registry handling oOdbcReg = CREATEOBJECT("OdbcReg") ** general registry handling oReg = CREATEOBJECT("Registry") * I want only user dsn's but there doesn't seem to be a direct * way to get them so I have to get everything, then get the * system and file dsns and subtract ** get list of all user,system and file dsns llOk = (oOdbcReg.getodbcdrvrs(@aAll, .T.) = 0) IF llOk && get list of system and file dsns only llOk = (oOdbcReg.GetOdbcdrvrs(@aSome, .F.) = 0) ENDIF IF llOk lnInc = 0 FOR lnCount = 1 TO ALEN(aAll) ** is this one (system or file) in the everything array? IF ASCAN(aSome, aAll[lnCount]) = 0 ** it is not, so add it to my user dsn array lnInc = lnInc + 1 DIMENSION aDsn[lnInc] aDsn[lnInc] = aAll[lnCount] ENDIF ENDFOR IF !EMPTY(aDsn[1]) && we have at least one ** get the value of the dsn key in the current user odbc list FOR lnCount = 1 TO ALEN(aDsn) lcVal = SPACE(100) && info holder oReg.GetRegkey(aDsn[lnCount],@lcVal, ; "Software\ODBC\ODBC.INI\ODBC Data Sources", ; HKEY_CURRENT_USER) IF "*.dbf" $ lcVal && contains '.dbf'? ** yes, so display the key and the value ? aDsn[lnCount], '"' + lcVal + '"' ENDIF ENDFOR ELSE MESSAGEBOX("Nothing Found") ENDIF ENDIF