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

  • Savvy enterprises are discovering that the cloud holds the power to transform IT processes and support business objectives. IT departments can use the cloud to redefine the continuum of development and operations—a process that is becoming known as DevOps. Download the Executive Brief DevOps: Why IT Operations Managers Should Care About the Cloud—prepared by Frost & Sullivan and sponsored by IBM—to learn how IBM SmartCloud Application services provide a robust platform that streamlines …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds