IFilterInfo.Filename

 
Microsoft DirectShow 9.0

IFilterInfo.Filename

  • Note   This topic is deprecated. It applies to Visual Basic 6.0. DirectShow is not supported for Visual Basic .NET or C#.

The Filename property sets or retrieves the name of the file loaded by this filter.

Syntax

  objFilterInfo
  .Filename As String

Parameters

This property takes no parameters.

Return Values

Returns the name of the file.

Remarks

Only file-source filters support this property. Accessing this property on other filters will cause a run-time error. To determine whether a filter is a file-source filter, check the IFilterInfo.IsFileSource property.

This property is read/write. Setting this property causes the filter to load the specified file. If the filter has already loaded a file, setting this property causes a run-time error.

Example Code

The following example searches for source files in the filter graph and displays the file name for each one:

For Each objFilter In mGraph.FilterCollection
    If objFilter.IsFileSource = True Then
        MsgBox objFilter.FileName
    End If
Next

The next example adds the Async File Source filter to the filter graph, loads a file, and builds the rest of the graph. (Although you could do this in one step with the FilgraphManager.RenderFile method, you can use the Filename property with custom file-source filters.)

Dim objRegFilter As IRegFilterInfo
For Each objRegFilter In mGraph.RegFilterCollection
    If objRegFilter.Name = "File Source (Async.)" Then
        objRegFilter.Filter SrcFilter
        Exit For
    End If
Next
If Not SrcFilter Is Nothing Then
    SrcFilter.FileName = "C:\MyVideo.avi"
    For Each objPin In SrcFilter.Pins
        objPin.Render
    Next
End If

See Also