IMFAttributes::GetString Method

Retrieves a wide-character string associated with a key.

Syntax

public:
HRESULT GetString(
         REFGUID guidKey,
         LPWSTR pwszValue,
         UINT32 cchBufSize,
         UINT32 *pcchLength
)  

Parameters

guidKey
Type: REFGUID 

[in]

GUID that identifies which value to retrieve. The attribute type must be MF_ATTRIBUTE_STRING.

pwszValue
Type: LPWSTR 

[out]

Pointer to a wide-character array allocated by the caller. The array must be large enough to hold the string, including the terminating NULL character. If the key is found and the value is a string type, the method copies the string into this buffer. To find the length of the string, call IMFAttributes::GetStringLength.

cchBufSize
Type: UINT32 

The size of the pwszValue array, in characters. This value includes the terminating NULL character.

pcchLength
Type: UINT32 *

[in, out, optional]

Receives the number of characters in the string, excluding the terminating NULL character. This parameter can be NULL.

Return value

Type: HRESULT 

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

Return codes
Return code Description
S_OK The method succeeded.
E_OUTOFMEMORY The length of the string is too large to fit in a UINT32 value.
E_NOT_SUFFICIENT_BUFFER The buffer is not large enough to hold the string.
MF_E_ATTRIBUTENOTFOUND The specified key was not found.
MF_E_INVALIDTYPE The attribute value is not a string.

Refer to Media Foundation return codes.

Remarks

You can also use the IMFAttributes::GetAllocatedString method, which allocates the buffer to hold the string.

Requirements

Header: Declared in mfobjects.h (include mfidl.h).

Library: Use Mfuuid.lib.