Search code examples
visual-c++explorerwindows-shellfile-propertiespropertyhandler

Does the Windows shell support multiple shell property handlers?


I was just trying out the Windows app sample for the Recipe Property Handler which is available here and I modified it to be used on .doc files instead of .recipe files:

const WCHAR c_szRecipeFileExtension[] = L".doc";

But, this seemed to overwrite the previous Office handler's properties with itself, which begs the question, does the Windows shell support multiple shell property handlers, or can you only use one at a time for a given file type? If its possible, what am I missing from the code or logic in the sample?

I couldn't find a concrete answer on MSDN for this question.


Solution

  • No.

    But there is a variant you can use (I dont like it but I dont see any additional variant). Save previous Property handler CLSID when you register your own. And when shell request the property that you cannot process - just create instance of previous handler and pass request to them.

    CoCreateInstance(SavedCLSID, nil, CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IPropertyStore, PS)
    PS.QueryInterface(IInitializeWithStream, IWS)
    IWS.Initialize(Stream, Mode)
    PS.GetValue(AUnknownKey)