IMFAttributes::Compare method

Compares the attributes on this object with the attributes on another object.


HRESULT Compare(
  [in]  IMFAttributes            *pTheirs,
  [out] BOOL                     *pbResult


pTheirs [in]

Pointer to the IMFAttributes interface of the object to compare with this object.

MatchType [in]

Member of the MF_ATTRIBUTES_MATCH_TYPE enumeration, specifying the type of comparison to make.

pbResult [out]

Receives a Boolean value. The value is TRUE if the two sets of attributes match in the way specified by the MatchType parameter. Otherwise, the value is FALSE.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription

The method succeeded.



If pThis is the object whose Compare method is called, and pTheirs is the object passed in as the pTheirs parameter, the following comparisons are defined by MatchType.

Match typeReturns TRUE if and only if
MF_ATTRIBUTES_MATCH_OUR_ITEMSFor every attribute in pThis, an attribute with the same key and value exists in pTheirs.
MF_ATTRIBUTES_MATCH_THEIR_ITEMSFor every attribute in pTheirs, an attribute with the same key and value exists in pThis.
MF_ATTRIBUTES_MATCH_ALL_ITEMSThe key/value pairs are identical in both objects.
MF_ATTRIBUTES_MATCH_INTERSECTIONTake the intersection of the keys in pThis and the keys in pTheirs. The values associated with those keys are identical in both pThis and pTheirs.
MF_ATTRIBUTES_MATCH_SMALLERTake the object with the smallest number of attributes. For every attribute in that object, an attribute with the same key and value exists in the other object.


The pTheirs and pbResult parameters must not be NULL. If either parameter is NULL, an access violation occurs.

This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.


Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]


Mfobjects.h (include Mfidl.h)



See also

Attributes and Properties