Simple Shell Extension to Manipulate File Summary Information

Introduction

CSimpleShlExt is a simple shell extension to manage file comments. With this extension, you can add comments to any file very easily (you right-click the file, go to Properties, and then switch to the Summary tab and add comments there) and can export the comments to clipboard in RTF, CSV, and Text formats to paste them into different applications that support these formats.

It's a very small utility. You already know that there are many other tools available for version controlling; these give you much more facilities. The aim of this extension was to have a very small and in-place facility to add the comments and get them on demand, just through a single click.

How to Use It

This is a simple ATL project. For your convenience, go through the following steps if you haven't created a single ATL project so far.

  1. Double-click the SimpleExt.dsw file, or open Visual C++ and open this workspace.
  2. If you don't have Unicode libraries installed, make sure that you have selected "Win32 Release MinDependency" or "Debug" in the build toolbar.
  3. Compile the project.

That's it; trust me. I'm not kidding. Now, right-click any file; you'll find two new options in the context menu. They are:

  • Add Comment
  • Export Comment(s)

Now, if you click the first option (Add Comment), you'll go directly to the Properties->Summary page to enter a file's details. You can enter different comments to different files, and then select multiple files. Again, right-click and select the other option (Export Comment(s)). After that, launch Notepad, Excel, or Word and use Ctrl+V or paste option from the Edit menu and there you go; the comments are there for all the selected files.

Details

If you don't want to get into the details and just want to enjoy it, you can skip this part. But if you don't, there are two classes in this project:

  • CSimpleShlExt: It's the main class that implements the shell extension and context menu options.
  • CFileSummary: This is the file that is used to extract the file comments.

Okay, if you go into the details, you'll find that in NTFS, comments, and other summary details are stored into streams along with the file, but that is not same with MS-Office files, such as Word or Excel files; they are called as compound files and getting the comments stored with them is different than with other files. For further explanation, you can consult MSDN or go to www.google.com.

All the functionality of retrieving the file comments and other summary details is encapsulated in this class. You can use this class in any other project (MFC or non-MFC based as well) to get the comments of files stored. The simple way is this:

CFileSummary fs;
fs.ExtractFileSummary( "c:\\myfolder\\myfile.txt" );
string strComment = fs.GetComments();

Similarly, you can get other details by calling the respective functions of CFileSummary. Life is good, if things get simple, isn't it? Enjoy!



Downloads

Comments

  • Got any Ideas?

    Posted by dblack on 04/04/2006 05:40pm

    I got this to work but had to change the look-up table to access the items. I am using Win2K SP4 and Visual C# 2005
    Thanks in advance,
    Dan
    dblack@dbland.net
    
    original look-up
    switch (oDFI.ID)
    {
        case 2:
            sFileType = oDFI.Value;
            break;
        case 9:
            sFileAuthor = oDFI.Value;
            break;
        case 10:
            sFileTitle = oDFI.Value;
            break;
        case 11:
            sFileSubject = oDFI.Value;
            break;
        case 12:
            sFileCategory = oDFI.Value;
            break;
        case 14:
            sFileComment = oDFI.Value;
            break;
        default:
            break;
    }
    
    
    my look-up
    switch (oDFI.ID)
    {
        case 2:
            sFileType = oDFI.Value;
            break;
        case 9:
            sFileAuthor = oDFI.Value;
            break;
        case 11:
            sFileTitle = oDFI.Value;
            break;
        case 12:
            sFileSubject = oDFI.Value;
            break;
        case 13:
            sFileCategory = oDFI.Value;
            break;
        case 5:
            sFileComment = oDFI.Value;
            break;
        default:
            break;
    }

    Reply
  • Fantastic!

    Posted by Ajay Vijay on 11/03/2004 03:47am

    I really liked that!

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

Top White Papers and Webcasts

  • Despite the popularity of cloud software, many companies are reluctant to move their contact centers to the cloud. This white paper breaks down cloud architecture, the benefits of cloud and the difference between cloud and on-premise systems. It's a helpful resource for companies who are curious about cloud contact center software but have reservations. It offers practical explanations, extensive research and a guide to selecting the right cloud contact center vendor.

  • Speed. Agility. Flexibility. There are the big drivers behind most organizations' move to the cloud for their test/dev environments. Freed from the shackles of physical, on-premises infrastructures means test/dev teams can be incredibly fast, both in standing up and tearing down test beds. They can manage version control and they can share work between teams faster ever than below. Read this white paper to learn how your business can respond faster to the rapidly changing needs of customers with a cloud-based …

Most Popular Programming Stories

More for Developers

RSS Feeds

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