|Title||Count the lines of code in Visual Basic 5/6 projects within a directory hierarchy|
|Description||This example shows how to count the lines of code in Visual Basic 5/6 projects within a directory hierarchy.|
|Keywords||count lines, project, forms, modules, subs, subroutines, functions|
This program uses drive, directory, and file list controls to let you select a directory. It then uses the FindFirstFile, FindNextFile, and FindClose API functions to examine the Visual Basic .VBP project files in and below that directory in the directory hierarchy. It opens each .VBP file and reads the frm, bas, and cls files the project uses.
The program then opens those files. It finds the start and finish of the frm files' control declarations and it counts the subroutines, functions, properties, comments, and lines in the rest of the file.
This program produced the following results for the directory where I store most of the VB Helper examples:
Total Controls: 49909
Total Lines: 130952
Total Subs: 5823
Total Functions: 985
Total Properties: 463
Total Comments: 24345
See also Count the lines of code in a Visual Basic 5/6 project.