Share via


IWMEncSourceGroupCollection.Count

Windows Media Encoder SDK banner art

The Count property retrieves the number of source groups in the collection.

Syntax

int = IWMEncSourceGroupCollection.Count;

Parameters

This property takes no parameters.

Property Value

An Int32 that indicates the number of source groups in the collection.

Remarks

This property is read-only. This method is the C# version of the JScript IWMEncSourceGroupCollection.length method.

Example Code

using WMEncoderLib;

try
{
// Create a WMEncoder object.
WMEncoder Encoder;
Encoder = new WMEncoder();

// Declare objects and variables.
IWMEncSourceGroupCollection SrcGrpColl;
IWMEncSourceGroup SrcGrp;
IWMEncSourceGroup SrcGrp1;
IWMEncSourceGroup SrcGrp2;
IWMEncSourceGroup SrcGrp3;
int i;

// Create an IWMEncSourceGroupCollection object.
SrcGrpColl = Encoder.SourceGroupCollection;

// Add new source groups to the collection.
SrcGrp1 = SrcGrpColl.Add("SG_1");
SrcGrp2 = SrcGrpColl.Add("SG_2");
SrcGrp3 = SrcGrpColl.Add("SG_3");

// Loop through the collection to find a specific
// source group.
for (i = 0; i < SrcGrpColl.Count; i++)
{
    SrcGrp = SrcGrpColl.Item(i);
    if (SrcGrp.Name == "SG_3")
    {
        // Move SrcGrp3 in front of SrcGrp1.
        SrcGrpColl.Move(SrcGrp3, SrcGrp1);
        // Make ScrGrp3 active.
        SrcGrpColl.Active = SrcGrp3;
    }
}

// Remove SrcGrp2, by index, from the collection.
SrcGrpColl.Remove(2);
}

catch (Exception e)
{
     // TODO: Handle exceptions.
}

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also