Share via


IWMDRMProfileCollection.Item

Windows Media Encoder SDK banner art

The Item method retrieves a specific DRM profile from the collection.

Syntax

IWMDRMProfile IWMDRMProfileCollection.Item(
  object  var
);

Parameters

var

[in]  Object containing the index into the DRM profile collection or a specific DRM profile ID.

Return Values

This method returns an IWMDRMProfile object.

Remarks

The input parameter is an index into the collection of DRM profiles, or a DRM profile ID. If you don't already know the index associated with DRM profile you want, iterate through the collection starting at item 0. On each iteration, increment the index and use the Item method to retrieve a pointer to each profile. Call the IWMDRMProfile.Name property to find the name of the current profile and compare the name retrieved to that needed. Exit the loop when a match is found.

Example Code

using WMEncoderLib;

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

// Create an IWMDRMContentAuthor object.
  IWMDRMContentAuthor DRM;
  DRM = Encoder.EncoderDRMContentAuthor;

// Retrieve the collection of DRM profiles.
  IWMDRMProfileCollection DRMProColl;
  DRMProColl = DRM.DRMProfileCollection;

// Create an IWMDRMProfile object.
  IWMDRMProfile DRMPro;

// Iterate through the DRM profiles in the collection.
  for (int x = 0; x < DRMProColl.Count; x++)
  {
    DRMPro = DRMProColl.Item(x);
    MessageBox.Show(DRMPro.Name);
  }
}

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

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also