Windows Media Encoder SDK banner art

The Item method retrieves a specific device control object from the collection.


IWMEncDeviceControl = IWMEncDeviceControlCollection.Item(lIndex)



[in]  Long containing the index of the item in the collection.

Return Values

This method returns an IWMEncDeviceControl object.

If this method fails, it returns an error number.


Use the Count property to retrieve the number of objects in the device control collection.

To control digital devices programmatically, you must add the Windows Media Encoder Device Control reference to the project. For more information, see Programming in Visual Basic.

Example Code

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

' Add the device as the audio source and the video source.
  Dim SrcGrpColl As IWMEncSourceGroupCollection
  Dim SrcGrp As IWMEncSourceGroup2
  Dim SrcAud As IWMEncSource
  Dim SrcVid As IWMEncVideoSource
  Set SrcGrpColl = Encoder.SourceGroupCollection
  Set SrcGrp = SrcGrpColl.Add("SG_1")
  Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
  Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
  ' Replace the following name with the name of your device.
  SrcAud.SetInput ("Device://Device resource name")
  SrcVid.SetInput ("Device://Device resource name")

' Configure the output and profile.

' Retrieve the device control collection, then add a device to it.
  Dim DCColl As IWMEncDeviceControlCollection
  Set DCColl = SrcGrp.DeviceControlCollection
  Dim DControl As IWMEncDeviceControl
  Set DControl = DCColl.Add
  ' Replace the following name with the name of your device.
  DControl.SetInput ("DeviceControl://Device resource name")

' Create a new IWMEncDeviceControl and retrieve the first object
' from the device control collection.
  Dim DControl2 As IWMEncDeviceControl
  Set DControl2 = DCColl.Item(0)


Reference: Windows Media Encoder Device Control

Library: wmdevctl.dll

See Also