Freigeben über


IMFMediaEvent::GetValue Method

Retrieves the value associated with the event, if any. The value is retrieved as a PROPVARIANT structure. The actual data type and the meaning of the value depend on the event.

Syntax

HRESULT GetValue(
  [out]  PROPVARIANT *pvValue
);

Parameter

  • pvValue [out]
    Pointer to a PROPVARIANT structure. The method fills this structure with the data.

Rückgabewert

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

Rückgabecode Beschreibung
S_OK

The method succeeded.

 

Hinweise

Before calling this method, call PropVariantInit to initialize the PROPVARIANT structure. After the method returns, call PropVariantClear to free the memory that was allocated for the PROPVARIANT data.

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

  • Windows XP mit Service Pack 2 (SP2) und höher.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (Oktober 2006 Updaterollup für Windows XP Media Center Edition) installed.

Beispiele

The following function gets the event value if the value is an IUnknown pointer. If the PROPVARIANT type is not VT_UNKOWN, the function returns MF_E_INVALIDTYPE.

//  Gets an IUnknown pointer from an IMFMediaEvent event and queries 
//  the pointer for a specified interface.
//
//  NOTE: Applies only to events that contain IUnknown pointers.
//        Otherwise, the function returns MF_E_INVALIDTYPE.

template <class Q>
HRESULT GetEventObject(IMFMediaEvent *pEvent, Q **ppObject)
{
    *ppObject = NULL;   // zero output

    PROPVARIANT var;
    HRESULT hr = pEvent->GetValue(&var);
    if (SUCCEEDED(hr))
    {
        if (var.vt == VT_UNKNOWN)
        {
            hr = var.punkVal->QueryInterface(ppObject);
        }
        else
        {
            hr = MF_E_INVALIDTYPE;
        }
        PropVariantClear(&var);
    }
    return hr;
}

Anforderungen

Mindestens unterstützter Client

Windows Vista

Mindestens unterstützter Server

Windows Server 2008

Header

Mfobjects.h (include Mfidl.h)

Bibliothek

Mfuuid.lib

Siehe auch

IMFMediaEvent

Media Event Generators