Line Counter for MS VC++ 6.0 Projects


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


Click here for larger image

Environment: VC6 SP4, WIN NT 4.0 / 2000, WIN 9x (95, 98, Me)

Anyone ever wondered how many lines are in a project you worked on for a month (or maybe for a year!)? Well, we did this for you :)

This program (LineCounter) was developed with one purpose only: to count your lines!

The program is able to count source code, comments (both styles: "// comment" and "/* comment */"), and blank lines. It shows the results in a couple of editboxes, and has a preview window (right click on the list).

The program opens the project file (.dsp) and throws it through the parsing code. After parsing is done the list of project files is steped-by-step and lines are counted.

That's it! The source code is pretty self explanatory, so I guess you'll manage.


Download source (LineCounter_src.zip)- 37.9 Kb


  • Good Work. Thank You.

    Posted by Legacy on 02/11/2004 08:00am

    Originally posted by: david d

    I recommend to add in the next version:
    - write the result to file.
    - Auto 'Count'.
    (I allready do that. Mail me to get.)

  • Cool program. Well balanced to the job.

    Posted by Legacy on 08/20/2002 07:00am

    Originally posted by: Conrad

    I works, also I picked up that my average comments for a project was 20%, and as U say, this is just a simple tool to get an idea of mileage :-)
    Users must be aware, that files like stdafx.h will come in at >50% comments if you do like I do and add "banners" to every source-file, since this is policy where I work.

    This tool really helps find files that need more commenting, and the basic thing to remember, is that if the code is simple, leave out the comments, if it is complex, add lots; So trying to get all your code to a "level" will not make your program/project any more maintainable than the next one.

    This program has a nice balance of complexity with functionality.

  • Nice thing!

    Posted by Legacy on 03/14/2002 08:00am

    Originally posted by: Michael Kramar

    I didn't check if it calculates all right, I tink no metter if it is not absolutelly accurate. But I like it! I have spent much time doing this manually. Thank you!

  • There's a Visual C++ add-in which already does this

    Posted by Legacy on 10/10/2001 07:00am

    Originally posted by: Andy Metcalfe

    Oz Solomonovich (the author of WndTabs) has already published a Visual C++ add-in which does this - the Project Line Counter (http://www.codeproject.com/macro/linecount.asp).

    FYI for my money the two versions complement each other; at some times you want an app, sometimes an add-in. :)

  • Wrong results in "release" version...

    Posted by Legacy on 10/10/2001 07:00am

    Originally posted by: Andrew Ushakov

    Sorry, but your program works properly only when compiled in debug configuration. May be, it has uninitalized variables?

  • Excellent

    Posted by Legacy on 10/04/2001 07:00am

    Originally posted by: Jase Jennings

    What a great little utility! I've often wondered how many source lines were in my projects ... i think I shall extend it to parse .dsw's.


  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date