Share via


IWMEncAttributes.Item

Windows Media Encoder SDK banner art

The Item method retrieves a specific name-value pair from the collection of user-defined attributes.

Syntax

Variant = IWMEncAttributes.Item (iIndex, strName)

Parameters

iIndex

[in]  Long containing the index number of the attribute in the collection.

strName

[out]  String containing the attribute name.

Return Values

If this method succeeds, it returns a Variant containing the attribute value and another Variant containing the name. If this method fails, it returns an error number.

Return code Description
0xC00D0011 The input parameter does not match a valid index in the attributes collection.

Remarks

You can iterate through the collection and use this method to find the index for a specific attribute. Call IWMEncAttributes.Count first to determine the upper limit of the number of items you must iterate through.

Example Code

' Create a WMEncoder object.
Dim Encoder As WMEncoder
Set Encoder = New WMEncoder

' Retrieve an IWMEncAttributes object.
Dim Attr As IWMEncAttributes
Set Attr = Encoder.Attributes
Dim i As Integer
Dim sName As String
Dim sValue As String

' Add three custom attributes to the collection.
Attr.Add "Date created: ", "02/15/2000"
Attr.Add "Time created: ", "13:30:15"
Attr.Add "File content: ", "multimedia data"

' View the attributes in the collection.
For i = 0 To Attr.Count - 1
  sValue = Attr.Item(i, sName)
Next i

' Remove an attribute by name.
Attr.Remove ("File content: ")

' Remove an attribute by index.
Attr.Remove (0)

' Remove any remaining attributes.
Attr.RemoveAll

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also