> Yeah just list the key outta the registry !! do a search with reg edit to
> find the key then use Tregistry component to read the key into the list
box
> Thanks
> Aaron
> "D De Villiers" <~ddevilliers9...@lando.co.za> wrote in message
> news:avkl2p$hhh$2@ctb-nnrp2.saix.net...
> > Hello All,
> > How can I get a list of all system ODBC datasource names (DSN) into a
> > combobox ?
> > Ive the following VB (6.0 Pro) code but finding it hard to port to
Delphi:
> > Const SQL_SUCCESS As Long = 0
> > Const SQL_FETCH_NEXT As Long = 1
> > Private Declare Function SQLDataSources Lib "ODBC32.DLL" (ByVal henv As
> > Long, ByVal fDirection As Integer, ByVal szDSN As String, ByVal cbDSNMax
> As
> > Integer, pcbDSN As Integer, ByVal szDescription As String, ByVal
> > cbDescriptionMax As Integer, pcbDescription As Integer) As Integer
> > Private Declare Function SQLAllocEnv Lib "ODBC32.DLL" (env As Long) As
> > Integer
> > Private Sub LoadCmboDsn()
> > On Error Resume Next
> > Const iDsnMaxLen As Integer = 1024
> > Const iDrvMaxLen As Integer = 1024
> > Dim iRslt As Integer
> > Dim sDsnItem As String * iDsnMaxLen
> > Dim sDrvItem As String * iDrvMaxLen
> > Dim sDsn As String
> > Dim iDsnLen As Integer
> > Dim iDrvLen As Integer
> > Dim lhEnv As Long 'handle to the environment
> > 'get the DSNs
> > If (SQLAllocEnv(lhEnv) <> -1) Then
> > Do
> > sDsnItem = Space$(iDsnMaxLen)
> > iRslt = SQLDataSources(lhEnv, SQL_FETCH_NEXT, _
> > sDsnItem, iDsnMaxLen, iDsnLen, _
> > sDrvItem, iDrvMaxLen, iDrvLen)
> > sDsn = Left$(sDsnItem, iDsnLen)
> > If (sDsn <> Space$(iDsnLen)) Then
> > cmboDsn.AddItem sDsn
> > End If
> > Loop Until (iRslt <> SQL_SUCCESS)
> > End If
> > End Sub
> > Using Delphi 5.0 Enterpise Edition
> > Kind Regards,
> > Lennie De Villiers
> > EMail: ddevilli...@lando.co.za
> > Web: www.lando.co.za/Lennie
> > CV/Resume: www.lando.co.za/Lennie/CV.htm
> > "Real programmers don't document. If it was hard to write, it should
> > be hard to understand."