Thanks to this component, developers can easily enumerate files and folders in the specified folder and all its subfolders and perform related tasks. Among them filtering folder and file list using various filter criteria, searching file contents for words or phrases using the ANSI and Unicode encodings and even building a visual tree of folder and files!
xDir highly reduces the total time needed to implement these tasks from scratch or even if you use source codes from the Internet as a basis for your development. Having xDir, you can code all these file/folder tasks in a couple of minutes or even in 20-30 seconds. Your code becomes easily maintainable and portable as you deal with simple properties and events.
In addition to all this, xDir works super-fast as its file/folder functionality is based on efficient Windows API calls. For instance, xDir enumerates all files in the C:\WINDOWS folder and all its subfolders in Windows 10 Professional 64-bit (120'696 files) and notifies you about every item just in about 3 seconds on a test PC with an Intel Core i5 processor.
xDir is available in two editions - Standard and Professional. The Standard edition is 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 a background process using asynchronous mode without blocking the main thread with the user interface.
xDir provides high performance and can enumerate nested folders in contrast to the VB/VBA standard
Dir function. The library name is a shortenting for "extended Dir". This name also implies a wider range of avaiable functions compared to the built-in VB Dir function.
It is very easy to use xDir in your application. All you need to do is to create an instance of the
xDir object, implement the callback function to receive notifications about found items and launch an enumeration using the
ProcessFolder method. Below is an example of xDir code to enumerate all files in the C:\WINDOWS folder and all of its nested folders:
Implements IXDFoundItem Private Sub Command1_Click() Dim xd As New xDir xd.RootFolder = "C:\WINDOWS" xd.ProcessFolder Me End Sub Private Sub IXDFoundItem_Proc(ByVal ParentFullPath As String, _ ByVal ItemName As String, ByVal ItemType As EItemTypes, _ CancelEnum As Boolean, ByVal UserValue As Long) List1.AddItem ParentFullPath & ItemName End Sub
When the user presses the command button named Command1, the code above populates the listbox named List1 with the full file names from the specified folder.