How to register a System Supplied Property Handler for XPS and OPC files in registry for a custom file type?

StackOverflow https://stackoverflow.com/questions/18258962

  •  24-06-2022
  •  | 
  •  

Question

I'm creating a custom file format for use by my application based on the OPC (or maybe the XPS) file format. This MSDN link, Using System-Supplied Property Handlers, gives an example but it doesn't appear to be correct. Does anybody know how to do this properly?

Edit: This can apply to OPC files as well as XPS. XPS is build on top of OPC.

Was it helpful?

Solution

You have to:

  1. Create a key named with your extension (e.g. a key named .doc) under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PropertySystem\PropertyHandlers.
  2. Then set the default value for the key you just created to {45670FA8-ED97-4F44-BC93-305082590BFB}
  3. Under Root/SystemFileAssociations add a key named with your file extension (e.g. .doc).
  4. Under that key add "shellex\PropertyHandler"
  5. Set default value under the PropertyHandler key to {45670FA8-ED97-4F44-BC93-305082590BFB}.

    1. Now you have to tell Windows what properties to display depending on circumstance.

      • Add FullDetails, PreviewDetails, ExtendedTileInfo, and InfoTip keys to the Root/SystemFileAssociations/ key.

This property handler is good for both OPC (open package conventions) and XPS files.

  • PreviewDetails is the property pane at the bottom of windows explorer (Win 7) or the left hand side of explorer (Win 8).

  • FullDetails is the properties you see when you right click and select properties and go to the Details tab.

    • InfoTip is the properties you see when you hover over a file.

    • ExtendedTileInfo I'm not sure about. I think it's the properties you see when you select the content folder view in explorer.

{45670FA8-ED97-4F44-BC93-305082590BFB} is the GUID for the OPC/XPS property handler given in the MSDN link in my question.

OPC is basically a standard for creating a (zipped) file type. Can see more here: MSDN Magazine - Aug. 2007 OPC - A New Standard For Packaging Your Data.

I only tested in Windows 7 but it should work in Vista and above. I'll post back after I do further testing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top