>SAMPLE: How to List Directories on Entire Drive >ID: Q139964 > >File Search User-Defined Function (UDF) Example >ID: Q117216 >But Neil,
*-- Fill the tree values Procedure filltree Lparameters tcDirectory, tcType This.show oNode=THIS.oleTreeview.nodes.add(,tvwFirst,left(tcDirectory,1)+'_Drive',tcDirectory,tcType) This._SubFolders(oNode) This.olecontrol2.panels(1).text = "Ready" Endproc *-- Collect subfolders Procedure _SubFolders Lparameters oNode Local nChild, oNodex lcFolder = oNode.Fullpath lcFolder = strtran(lcFolder,":\\",":\") oFS = CREATEOBJECT('Scripting.FileSystemObject') oFolder = oFS.GetFolder(lcFolder) With ThisForm.oleTreeview.nodes If oNode.Children > 0 If oNode.Child.Key = oNode.Key+"dummy" .Remove(oNode.Child.Index) nChild = 1 For each oSubFolder in oFolder.Subfolders oNodex = .Add(oNode.Key, tvwChild, ; oNode.Key+padl(nChild,3,"0"), oSubFolder.name, "ClosedFolder", "OpenFolder") If oSubFolder.Name # "System Volume Information" and oSubFolder.Subfolders.Count > 0 oNodex = .Add(oNode.Key+padl(nChild,3,"0"), tvwChild, ; oNode.Key+padl(nChild,3,"0")+"dummy", "Loading...", "ClosedFolder" ) Endif nChild = nChild+1 Endfor Endif Else If oFolder.Subfolders.count > 0 oNodex = .Add(oNode.Key, tvwChild, ; oNode.Key+"dummy", "Loading...", "ClosedFolder" ) Endif Endif Endwith Endproc Procedure Init oFS = CREATEOBJECT('Scripting.FileSystemObject') For Each Drive In oFS.Drives Do case Case Drive.DriveType = 0 lcType = 'Unknown' Case Drive.DriveType = 1 lcType = 'Floppy' Case Drive.DriveType = 2 lcType = 'Drive' Case Drive.DriveType = 3 lcType = 'Netdrive' Case Drive.DriveType = 4 lcType = 'CDdrive' Case Drive.DriveType = 5 lcType = 'Ramdrive' Endcase If Drive.IsReady This.filltree(Drive.DriveLetter+":\", lcType) Endif Endfor Endproc Procedure oleTreeview.Expand *** ActiveX Control Event *** Lparameters node Thisform._SubFolders(node) Node.ensurevisible EndprocCetin