Article View: comp.lang.basic.visual
Article #166Re: Directory Recursion
From: Josef Haselberger
Date: Mon, 29 Mar 1999 00:00
Date: Mon, 29 Mar 1999 00:00
116 lines
4750 bytes
4750 bytes
I use a home mage DLL 32Bit for this task
you can find it at
http://www.geocities.com/SiliconValley/Sector/8404/archiv/docinfo.zip
(46k)
BAS File Header
and Coding Example follows..
Private Sub PopulateDir2(ByVal n As Node, ByVal d As String, ByVal
ebene As Integer)
Dim myName As String * 100
Dim mNode1 As Node
Dim hDir As Long
Dim x, s As String
Dim flags As Integer
x = ""
flags = DIR_SUBDIR
hDir = GetDirFirst(d + "\*.*", flags, myName, 99)
s = alltrim(myName)
While s <> ""
If s <> "." And s <> ".." Then
'--- Verzeichnise einf�gen
Set mNode1 = tvwDB.Nodes.Add(n.Key, tvwChild, d + "\" + s,
s, "geschlossen")
mNode1.ExpandedImage = "ge�ffnet"
If ebene < 2 Then
mNode1.Expanded = True
End If
If ebene = 1 Then
Progress.Value = i
End If
'--- Tiefergelegene Verzeichnisse eintragen
PopulateDir2 mNode1, d + "\" + s, ebene + 1
End If
flags = DIR_SUBDIR
If GetDirNext(hDir, flags, myName, 99) Then
s = alltrim(myName)
Else
s = ""
End If
Wend
End Sub
-- Ratzefumm@gmx.net
'-----------------------------------------
' Headerdatei zu DOKINFO.DLL
' (c) Hasitech 98
' Letzte �nderung:
' 25.2.98 Flags aus DIR-Funktionen zur�ckgeben eingebaut.
'-----------------------------------------
Global Const DIR_ARCHIV = 32
Global Const DIR_HIDDEN = 2
Global Const DIR_NORMAL = 0
Global Const DIR_RDONLY = 1
Global Const DIR_SUBDIR = 16
Global Const DIR_SYSTEM = 4
Declare Function GetPDFDocInfo Lib "docinfo.dll" (ByVal Pfad As
String, ByVal tag As String, ByVal res As String) As Integer
Declare Function GetVolLable Lib "docinfo.dll" (ByVal Pfad As String,
ByVal lable As String, ByVal syslable As String) As Integer
' GetDirFirst(pfad,nFlags, Name, Maxlen)
' pfad="c:\*.*"
' Flags: 32=Archiv, 2=Hidden, 0=Normal, 1=RDOnly,
' 16=Subdir, 4=Systemfile
' Receivevariable Name enth�lt den gefundenen Namen "FILENAM.NAM"
' Maximall�nge des Receivestrings
' Returnwert ist der Handle auf die Suchstruktur, n�tig f�r GetDirNext
Declare Function GetDirFirst Lib "docinfo.dll" (ByVal Path As String,
ByRef flags As Integer, ByVal Name As String, ByVal Maxlen As Integer)
As Long
' hDir ist der Returnwert (LONG) aus dem GetDirFirst Aufruf
' Flags: 32=Archiv, 2=Hidden, 0=Normal, 1=RDOnly,
' 16=Subdir, 4=Systemfile
' Receivevariable Name enth�lt den gefundenen Namen "FILENAM.NAM"
' Maximall�nge des Receivestrings
' Returnwert ist der Handle auf die Suchstruktur, n�tig f�r GetDirNext
Declare Function GetDirNext Lib "docinfo.dll" (ByVal hDir As Long,
ByRef nFlags As Integer, ByVal Name As String, ByVal Maxlen As
Integer) As Long
"Ty" <tya@home.com> wrote:
>What I'm trying to do is do a pre-order directory listing. However, my sub
>prematurely ends at the "Name=Dir" when coming off a pop. What I'm I doing
>wrong? or can you suggest doing this a better way?
>
>Private Sub GetDirInfo(Path)
> Dim Name, Response
>
> Name = Dir(Path, vbDirectory)
> Do While Name <> ""
> If Name <> "." And Name <> ".." Then
> If (GetAttr(Path & Name) And vbDirectory) = vbDirectory Then
> Path = Path & Name & "\"
> Debug.Print Path
>
> GetDirInfo (Path)
> End If
> End If
> Name = Dir
> Loop
>End Sub
>
>--
>
>Thanks.
>-ty
>
>
Technical Details
Message-ID:
<36ff1b65.6156486@news.sie.siemens.at>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<BK%I2.4513$WM.1120@news.rdc1.wa.home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 108062,fcc273081167e07e X-Google-Attributes: gid108062,public X-Google-Thread: f645d,fcc273081167e07e X-Google-Attributes: gidf645d,public X-Google-Thread: fbd17,fcc273081167e07e X-Google-Attributes: gidfbd17,public X-Google-Thread: 1143a7,fcc273081167e07e X-Google-Attributes: gid1143a7,public X-Google-Thread: 107824,fcc273081167e07e X-Google-Attributes: gid107824,public From: josef.haselberger@siemens.at (Josef Haselberger) Subject: Re: Directory Recursion Date: 1999/03/29 Message-ID: <36ff1b65.6156486@news.sie.siemens.at> X-Deja-AN: 460238468 References: <BK%I2.4513$WM.1120@news.rdc1.wa.home.com> X-Complaints-To: news@siemens.at X-Trace: scesie13.sie.siemens.at 922688654 9972 195.17.21.56 (29 Mar 1999 06:24:14 GMT) Organization: Siemens AG Austria Reply-To: remove_josef.haselberger@siemens.at NNTP-Posting-Date: 29 Mar 1999 06:24:14 GMT Newsgroups: comp.lang.basic.visual,comp.lang.basic.visual.database,cz.comp.lang.basic.visual,fj.comp.lang.visualbasic,microsoft.public.vstudio.development