>************************************************** >*-- Class: dsnpreference (c:\vfe_apps\totalhr41\libs\acontrls.vcx) >*-- ParentClass: icombobox (c:\vfe_apps\totalhr41\ilibs\icontrls.vcx) >*-- BaseClass: combobox >*-- Time Stamp: 03/26/01 06:25:08 PM >* >#INCLUDE "c:\vfe7\vfeframe\include\vfe.h" >* >DEFINE CLASS dsnpreference AS icombobox > > > ColumnCount = (ALEN(This.aODBCData,2)) > ColumnWidths = "140,0" > RowSourceType = 5 > RowSource = "This.aODBCData" > FirstElement = 1 > NumberOfElements = (ALEN(This.aODBCData)) > Name = "dsnpreference" > DIMENSION aodbcdata[1] > > > PROCEDURE Init > Local oReg, aODBCData, cPreferenceValue > > With This > > oReg = createobj('odbcreg') > > Dimension aODBCData[1] > > oReg.GetODBCDrvrs(@aODBCData,.t.) > > Acopy(aODBCData, .aODBCData) > > .NumberOFElements = alen(.aODBCData) > .Requery() > > cPreferenceValue = This.oApplication.GetSetting('preferences','Data Source Name') > > If NOT EMPTY(cPreferenceValue) > .Value = cPreferenceValue > Endif > > Endwith > ENDPROC > > > PROCEDURE InteractiveChange > This.oApplication.SetSetting('preferences','Data Source Name',This.Value) > ENDPROC > > >ENDDEFINE >* >*-- EndDefine: dsnpreference >************************************************** >>
*-- Assume registry object exists (default foundation class of VFP 7.0) >>*-- So, oRegistry is an object >>LOCAL lcRHKey, lcRSubKey, lcDSNName, laVals[1,2] >>*-- now, I found some DSN's here in the registry >>lcRHKey = HKEY_CURRENT_USER >>lcRSubKey = "Software\ODBC\ODBC.INI\" >>*-- Here is what I don't know.... >> >>lcDSNName = oRegistry.GetEnumValues(@laVals, lcRegHKey, lcRegSubKey) >>*-- This does not work at all... I'm thinking I need to put in a for each loItem type thingy, but not sure... >> >>RETURN lcDSNName>>