Filter Object

On this page:

Description

This object represents a filter. A filter is a named collection of patterns, each one of which will match a file system item depending on its type and name.

Properties

Count read-only, IFilter

The number of patterns in the collection.

IDL [propget] HRESULT Count([out, retval] long* pValue)
.NET Int32 Count[get]

Item read-only, IFilter

Used to obtain a copy of one of the filter’s patterns.

IDL [propget] HRESULT Item(
    [in] VARIANT index,
    [out, retval] IFilterPattern** pValue)
.NET FilterPattern get_Item(
    Object index)

Name read/write, IFilter

The name of the filter.

IDL [propget] HRESULT Name([out, retval] BSTR* pValue)
[propput] HRESULT Name([in] BSTR newValue)
.NET String Name[get, set]

Methods

Add IFilter

Adds a copy of the specified pattern to the collection.

IDL HRESULT Add(
    [in] IFilterPattern* pattern,
    [out, retval] long* pValue)
.NET Int32 Add(
    FilterPattern pattern)

InitializeFromExcludePattern IFilter

Creates a list of exclude patterns for the filter from the string argument. The string can consist of any number of semicolon-separated patterns. Each pattern can optionally be wildcarded. Patterns ending in a back-slash character are assumed to match folders instead of files. For example, providing: *.obj;*.exe;Debug\;Release\ will cause five patterns to be added to the filter. The first pattern will cause all files and folders to be included, the second and third will then exclude files ending in .obj and .exe, and the fourth and fifth will exclude folders called Debug or Release.

IDL HRESULT InitializeFromExcludePattern(
    [in] BSTR pattern)
.NET void InitializeFromExcludePattern(
    String pattern)

InitializeFromIncludePattern IFilter

Creates a list of include patterns for the filter from the string argument. The string can consist of any number of semicolon-separated patterns. Each pattern can optionally be wildcarded. Patterns ending in a back-slash character are assumed to match folders instead of files. For example, providing: *.gif;*.wav;Images\;Sounds\ will cause four patterns to be added to the filter. The first and second patterns will include files ending in .gif and .wav, and the third and fourth will include folders called Images and Sounds.

IDL HRESULT InitializeFromIncludePattern(
    [in] BSTR pattern)
.NET void InitializeFromIncludePattern(
    String pattern)

Remove IFilter

Removes the pattern at the specified index in the collection.

IDL HRESULT Remove(
    [in] long index)
.NET void Remove(
    Int32 index)

RepositionPattern IFilter

Moves a pattern from one index to another in the collection.

IDL HRESULT RepositionPattern(
    [in] long oldIndex,
    [in] long newIndex)
.NET void RepositionPattern(
    Int32 oldIndex,
    Int32 newIndex)