This project has moved and is read-only. For the latest updates, please go here.
FileMetaContextMenuHandler is a COM service. It is invoked by the Explorer to add context menu items for every file of a type for which it is a registered context menu handler when the file is right clicked, and to perform the required actions when the menu items are clicked. It is implemented in C++.

The Context Menu handling is pretty much boilerplate, and is taken from the Microsoft CppShellExtContextMenuHandler sample.

The XML handling is provided by RapidXML. An example of exported metadata is:

<Metadata>
    <Storage Description="SummaryInformation" 
		FormatID="{F29F85E0-4FF9-1068-AB91-08002B27B3D9}">
        <Property Name="System.Document.DateCreated" Id="12"
				 Type="VT_FILETIME" TypeId="64">
            <Value>2013/04/15:20:02:50.160</Value>
        </Property>
        <Property Name="System.Author" Id="4" Type="VT_LPSTR" TypeId="30">
            <Value>Joe</Value>
        </Property>
        <Property Name="System.Comment" Id="6" Type="VT_LPSTR" TypeId="30">
            <Value>acomment</Value>
        </Property>
    </Storage>
</Metadata>

The FormatID is a GUID known to the system, as described here that identifies a property storage. In the pre-Vista API, IPropertySetStorage is used to access all property storages, and IPropertyStorage an individual storage within that set, each storage having its own FormatID. The corresponding friendly name for the storage is given in the description attribute, which is not read on import. The Vista and later IPropertyStore interface accesses all storages with a single interface, but still uses the combination FormatID and Id as unique property identifier.

Each property has a Name and an Id. The combination of the FormatID and the Id uniquely identify the property. The Name attribute of the property element is the corresponding canonical name provided by the system, and is given only for documentation, i.e. is not read on import.

The property values are Variants, and the XML records the TypeId of the Variant. This is used to interpret the string value of the property on import. The Type attribute of the property gives the friendly name of the Variant type. Again, this is not read on import.

The Vista and later IPropertyStore interface accesses all storages with a single interface, but still uses the combination FormatID and Id as unique property identifier. FileMetaContextMenuHandler uses IPropertySetStorage and IPropertyStorage to read the properties during export because it groups them conveniently by FormatID, but IPropertyStore to write the properties during import to avoid the complications of handling individual storages.

FileMetaContextMenuHandler also provides standard support for COM registration.

These pages describe the modifications the File Meta Association Manager makes to the registry for the context menu handler:

Linking to the context menu handler, for versions up to 1.3
Linking to the context menu handler 1.4, for version 1.4

Last edited Sep 7, 2016 at 11:49 AM by Dijji, version 7

Comments

No comments yet.