Filter Object

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

Countread-onlyIFilter

The number of patterns in the collection.

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

Itemread-onlyIFilter

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)
  • index
    An integer index into the collection.

Nameread/writeIFilter

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

AddIFilter

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)
  • pattern
    The pattern to add to the collection.

InitializeFromExcludePatternIFilter

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)
  • pattern
    The pattern string that is to be used to create the patterns within the filter.

InitializeFromIncludePatternIFilter

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)
  • pattern
    The pattern string that is to be used to create the patterns within the filter.

RemoveIFilter

Removes the pattern at the specified index in the collection.

IDL HRESULT Remove(
    [in] long index)
.NET void Remove(
    Int32 index)
  • index
    The index of the pattern to be removed.

RepositionPatternIFilter

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)
  • oldIndex
    The index of the pattern to be moved.
  • newIndex
    The index to which the pattern should be moved.