AddEffectAsync IPropertySet and MFT reference in store app RRS feed

  • Question

  • Hello,

    I am working with a modified version of the grayscale sample (in C++).  To configure the mft, I am sending IPropertySet to the mft via AddEffectAsync.  I also want to change mft settings at run-time so I used the suggestion in the following post:


    and this has been successful.

    One question, though, is how to pass a mft ptr back to the store app.  

    First I define my own interface (IID_IProp) and add/implement that in the mft.  

    Next, I send in an IPropertySet (myPropSet) to the mft using AddEffectAsync.

    Next, in the mft's SetProperties(), the mft adds itself to the property set like this:

    pPropSet->Insert(key, static_cast<IInspectable*>(this), &success );

    Then, the store app obtains a pointer to the mft like this:

    Object^ value = myPropSet->Lookup ( key );
    IUnknown *punk = reinterpret_cast<IUnknown*>(value);
    punk->QueryInterface ( IID_IProp, (void**)&pMftProps );
    This appears to work.  But I am a little doubtful about the method of passing a mft ptr back to the app.  Particularly in the use of reinterpret_cast.  I tried other methods but this is the only one that would compile.  Is there a better approach to this?

    Sunday, November 25, 2012 11:42 PM


  • Hi,

    I think IInspectable is a Windows Runtime type. The IUnknown is a native type. Although IInspectable inherit from Iunknown, but this is a case from a Windows Runtime type to native type. The reinterpert_case should be reasonable.

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, November 27, 2012 7:19 AM