Share via


IWMEncDataViewCollection.Add

Windows Media Encoder SDK banner art

The Add method adds an IWMEncDataView object to the collection.

Syntax

Long = IWMEncDataViewCollection.Add(DataView)

Parameters

DataView

[in]  Unknown specifying the data view object.

Return Values

A Long that indicates the ID of the stream to view.

If this method fails, it returns an error number.

Number Description
0x80004005 An error occurred.
0x80070057 A parameter is not valid.
0x8007000E Memory cannot be allocated.
0xC00D1B66 This method cannot be called if the encoder engine is running.

Remarks

To display previews and postviews, you must add the Windows Media Encoder Preview 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

' Configure the encoding session including the input sources,
' the profile, and the output.

' Retrieve an IWMEncDataViewCollection object from the
' video source object to display a postview.
  Dim DVColl_Postview As IWMEncDataViewCollection
  Set DVColl_Postview = SrcVid.PostviewCollection

' Create a WMEncDataView object.
  Dim PostView As WMEncDataView
  Set PostView = New WMEncDataView

' Add the WMEncDataView object to the collection.
  Dim lPostviewStream As Long
  lPostviewStream = DVColl_Postview.Add(PostView)

' Start encoding.
  Encoder.Start

' Display the stream postview in a frame called PostviewFrame.
  PostView.SetViewProperties lPostviewStream, PostviewFrame.hWnd
  PostView.StartView (lPostviewStream)

Requirements

Reference: Windows Media Encoder Preview Control

Library: wmprevu.dll

See Also