Share via


IWMEncSourceGroupCollection.Active

Windows Media Encoder SDK banner art

The Active property specifies and retrieves the active source group.

Syntax

IWMEncSourceGroup = IWMEncSourceGroupCollection.Active;
IWMEncSourceGroupCollection.Active = IWMEncSourceGroup;

Parameters

This property takes no parameters.

Property Value

An IWMEncSourceGroup object.

If this property fails, it returns an error number.

Number Description
0xC00D1B72 No source group is currently active.

Remarks

The active source group is the one currently being encoded. Only one source group can be active at a time.

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