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

  • Managing your company's financials is the backbone of your business and is vital to the long-term health and viability of your company. To continue applying the necessary financial rigor to support rapid growth, the accounting department needs the right tools to most efficiently do their job. Read this white paper to understand the 10 essentials of a complete financial management system and how the right solution can help you keep up with the rapidly changing business world.

  • Flash technology is becoming more prominent in the storage industry. Offering superior speed and reliability when compared to traditional hard disk drives – flash storage is a flexible and increasingly cost-effective technology that can be used to optimize enterprise storage environments. This ebook explores the many uses and benefits of flash storage technology in the enterprise. Check it out to discover and learn all you need to: Optimize storage performance Leverage server flash as storage cache …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds