Freigeben über


What does a property handler accomplish?

A property handler is the piece of code that enables you to see the properties about your files as in the picture below.  Don't worry about the ambiguity in this sentence; I will be much more specific concerning what component does what in later posts.

Here I've created three .book files.  This is a file type I made up last weekend, so clearly Windows cannot know how to figure out all the data on the screen above without help.  That is where a property handler comes in.  It knows about the properties that apply to each .book file and helps Windows to display this information.

In addition to displaying properties, property handlers let users edit them within the standard Windows user interface:

Property handlers also let users search for files based on the property values.  I can search for "Haunting" and Windows will show "Blindness" in the result set.  And all this can happen from within the standard Windows user interface.

So, in summary, property handlers help your file types fit better into the Windows search and organize experience.  By exposing properties directly in the Windows UI, your users can seamlessly interact with your files without having to open them in applications all the time.  When they have property handlers, your file types feel less bolted onto Windows.

-Ben Karas

Comments

  • Anonymous
    January 22, 2007
    I got the impression that there was a built in property handler for OLE Compund Documents. We have written programs that use this file format and that works well in Win2k/XP, but in Vista we can't see the properties in the "preview bar" nor among the property sheets.In Win2K/XP the OS obviously found out by itself that this type of file had an OLE property store, but in Vista it does not.(It used to work in Vista Beta 2)For an exampel of what it looks like:http://thomasolsson.spaces.live.com/blog/cns!1EB93731488C4EA3!292.entryYou can see the same problem with other files that use OLE Compund Documents, such as Visio (have not tried Visio 2007 though).
  • Anonymous
    January 22, 2007
    There is a built-in property handler for OLE Compound Documents, but it must be specifically registered for your file type.  Set HKLMSoftwareMicrosoftWindowsCurrentVersionPropertySystemPropertyHandlers.myfile = {97e467b4-98c6-4f19-9588-161b7773d6f6}In my opinion, XP was too aggressive in the way it handled properties.  It assumed everything was an OLE Compound Document, or failing that, would store data in NTFS secondary streams.  This works great for setting properties on arbitrary types, but it leads to a whole slew of other bugs, including several where a user's data is lost.Vista avoids this assumption.  Instead, property handlers are explicitely registered and are assumed to provide a stronger guarantee that if they are storing properties, they are storing them properly in the file itself.
  • Anonymous
    January 22, 2007
    Ben,Adding our extension under PropertyHandlers and the provider {97e467b4-98c6-4f19-9588-161b7773d6f6} gave us the thumbnail preview back. Nice. :-)However, we still get no properties in the "preview pane" nor any propery sheet as we did in XP. :-(Are there any other registrations we need to do in order for the properties to work on Vista as they did in XP?(BTW, is this documented anywhere? I cannot find any mention of the CLSID in MSDN Lib.)
  • Anonymous
    January 22, 2007
    The comment has been removed
  • Anonymous
    January 23, 2007
    Nice!Now I can get the properties in both the preview pane and property sheet to work. Great!The thumbnail that we provide as an EMF scales beautifully as you move the slider of the View menu.The InfoTip also works fine, but I did not get the TileInfo to work. What is the ExtendedTileInfo used for?
  • Anonymous
    January 23, 2007
    TileInfo seems to require an explorer restart.  ExtendedTileInfo is not used.
  • Anonymous
    January 23, 2007
    A restart made the TileInfo work (the other settings did not require a restart)Now it all looks very nice.
  • Anonymous
    January 28, 2007
    Knowing what you are trying to accomplish is the first step to using the property system. Property handlers