Dir Function Replacement - xDir
Thanks to this component developers can easily enumerate files and folders in a specified folder and all of its subfolders, filter folder and file list using different criteria, implement context search in file contents using the ASCII and/or Unicode character-encoding scheme and create folder and file tree using information provided by the xDir component.
xDir 2.0 is available in two editions - Standard and Professional. The Standard edition has been compiled as an ActiveX DLL and allows you to gain the highest performance. The Professional edition has been implemented as an ActiveX-exe server and provides developers with the ability to enumerate files and folders in background process using asynchronous mode.
xDir provides high performance and can enumerate nested folders in contrast to VB standard Dir function (the name of the library means "extended Dir"). For instance, the Standard version enumerates all files in the C:\WINDOWS folder (11769 items) and generates for each file the corresponding event procedure approximately in 311 msec at our test PC with Pentium 4 1,7GHz, 512Mb DRAM under Windows XP Professional.
Using xDir in your applications is very simple: all you need is to create an instance of the xDir object, implement the IXDFoundItem interface and launch an enumeration using the ProcessFolder method. For instance, if you want to enumerate all files in the C:\WINDOWS folder and all of its nested folders, you need to write the following lines of code in your form module (for the Standard edition):
Private Sub Command1_Click()
Dim xd As New xDir
xd.RootFolder = "C:\WINDOWS"
Private Sub IXDFoundItem_Proc(ParentFullPath As String, _
ItemName As String, ByVal ItemType As EItemTypes, _
CancelEnum As Boolean, ByVal UserValue As Long)
List1.AddItem ParentFullPath & ItemName
The code above populates the listbox named List1 with file names (including full path) from the specified folder when the user presses the command button named Command1.
View Event Diagrams »