Simple Shell Extension to Manipulate File Summary Information

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

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 Azure® is a leading choice for businesses looking to take advantage of the cloud. Azure is particularly appealing to businesses that have already invested in Microsoft on-premises and are now considering running these applications and other workloads in the cloud. To understand how to make this move to Azure, many businesses are turning to managed service providers (MSPs) with specific Azure expertise. Read this white paper to learn the eight key areas to focus on when considering an MSP for an …

  • The software-defined data center (SDDC) and new trends in cloud and virtualization bring increased agility, automation, and intelligent services and management to all areas of the data center. Businesses can now more easily manage the entire lifecycle of their applications and services via the SDDC. This Aberdeen analyst report examines how a strong foundation in both the cloud and internal data centers is empowering organizations to fully leverage their IT infrastructure and is also preparing them to be able …

Most Popular Programming Stories

More for Developers

RSS Feeds

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