Line Counting, Version 1.1



Click here for a larger image.

Environment: VC5, VC6

Introduction

When working, we often need to count how many lines our programmers have developed, including source code lines, comment lines, and blank lines. This software, Counting ver1.1, is designed for that purpose. At first, I developed it to count my VC++ source code. Later, it was upgraded to count files such as VB, Java, ASP, JSP, and so on. By comparison, I found Counting is quicker and more accurate than other means, especially for some unfamiliar instances.

Advantages

  1. Accuracy. This function is absolutely necessary to any line-counting software. For that purpose, I created one test file (test.cpp), in which I designed some code lines that are reasonable but can easily be counted incorrectly. Counting (ver1.1) can count lines in test.cpp accurately.
  2. Speed. Due to proper process and good algorithms, Counting can count lines very quickly.
  3. Ease of use. Counting is easy to use and doesn't need to be installed.

How to Use

  1. Input the file name or extension in the "file or extension" (such as .cpp;*.c;*.h or counting.cpp; setting.c; resource.h), separated by ": , :". Click the combo box; you can select some extensions.
  2. Input the path in the "searching in" combo box.
  3. You can select whether to count in a subfolder.
  4. Click the "Count" button to begin counting; click it again to stop counting.
  5. You can click the "Save" button to save the counting result to a text file, Excel file, or CSV file.
  6. Double-click the control list to open the file.
  7. If both code and a comment lie on the same line, you can select a different method to count them in the Setting dialog box.

Author's Statement

This software is an open source. You can use it freely but don't remove any declaration about the author. Please let me know of any problems or improvements. Also, you can download the latest version on my personal home page. Thanks and good luck.

My e-mail address: xiaogi@sohu.com
Home page: http://xiaogi.nease.net

Downloads

Download demo - 173 Kb


Comments

  • Thanks to all

    Posted by Legacy on 02/13/2004 12:00am

    Originally posted by: xiaogi

    About "Memory Leak"
    I found the problem. In OnTimer(), I use LoadImage() to load an icon, then send it to mainframe. But after calling SendMessage(), I didn't free the icon resource by DestroyIcon(hPrevIcon). I didn't understand this problem for a long time until Dieter Hammer on CodeProject pointed out it. Thanks to him.

    About "Can't save Excel file"
    The reason is that there is some Chinese in the SaveAsExcelFile(). I corrected this problem.

    Please redownload source code from:
    http://xiaogi.nease.net/program/counting/counting_en.zip
    I will upload it tomorrow.(that is Feb 14, a happy valentine's day :p)

    Reply
  • Not working!

    Posted by Legacy on 02/10/2004 12:00am

    Originally posted by: M

    It is not working with big projects!
    It seems you did not allocate enough bits to the line counter (need 64 bits)

    Also you need to add the posibility to save the history result (and lable them) and maybe a nice chart will also be helpfull (to see the progress)

    It is also nice to get this info per sub-directory and not only total.

    Reply
  • Why count line?

    Posted by Legacy on 02/09/2004 12:00am

    Originally posted by: Coder+

    Might wanna add more feature to utility.
    like searching capabilities.
    Just counting lines is useless.

    Reply
  • compiler design?

    Posted by Legacy on 02/07/2004 12:00am

    Originally posted by: tampo

    Maybe you are designing your own IDE?
    This seems like a small feature for a larger module.

    Reply
  • Unable to Save to Excel file

    Posted by Legacy on 02/06/2004 12:00am

    Originally posted by: brraj

    I am not able to save to file.xls. it works with .txt and
    .csv but not with Xls.

    rajs

    Reply
  • Your code leaks GDI objects

    Posted by Legacy on 02/04/2004 12:00am

    Originally posted by: Mick

    I've sent you an email with a link to help you locate the problem. If you cannot find the problems, post in the CG forums or email me back.

    Reply
  • other 2 links

    Posted by Legacy on 02/04/2004 12:00am

    Originally posted by: Zhefu Zhang

    http://www.codeproject.com/macro/linecount.asp?target=line%7Ccounter

    http://www.codeproject.com/tools/linecounter.asp?target=line%7Ccounter

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

Top White Papers and Webcasts

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds