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

  • Microsoft® Office 365 is a top choice for enterprises that want a cloud-based suite of productivity collaboration applications. With Office 365, you get access to Microsoft™ Office solutions practically anytime, anywhere, on virtually any device. It's a great option for current Microsoft users who can now build on their experience with Microsoft™ solutions while enjoying the flexibility of a cloud-based delivery. But even organizations with no previous investment in Microsoft will find that …

  • For many organizations, moving enterprise applications to the public cloud can be a very attractive proposition, but planning the best way to move your applications is mission–critical. As an alternative to the costly option of re–architecting the application for a cloud environment, you can follow a "lift and shift" model that's significantly cheaper and almost always a lot quicker. In order to have a successful "lift and shift" migration, read this white paper to learn a few rules you should …

Most Popular Programming Stories

More for Developers

RSS Feeds

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