Microsoft DirectX 9.0


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


objFilterInfo.Filename As String


This property takes no parameters.

Return Values

Returns the name of the file.


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

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
If Not SrcFilter Is Nothing Then
    SrcFilter.FileName = "C:\MyVideo.avi"
    For Each objPin In SrcFilter.Pins
End If

See Also