SHCreateFilter (
    PCWSTR Name,
    PCWSTR InFolder,
    PROPERTYKEY const &PropertyKey,
    INT Type,
    ICondition *Condition,
    REFIID riid,
    PVOID *ppv);


The riid argument provides the IID of a desired interface to the filter object.

The ppv argument provides the address of a variable that is to receive a pointer to the desired interface.

Return Value

The function returns zero for success, else an error code.


If the function cannot obtain memory for the filter object, it fails, returning E_OUTOFMEMORY.

Except if the Name and Condition arguments are both NULL, the function initialises the filter object with copies of what’s passed in the Name, InFolder, PropertyKey, Type and Condition arguments. Failure to copy the strings or interface is failure for the function.

The function queries the newly created filter object for the interface given by riid, returning the interface pointer via the variable at ppv. Failure to find the desired interface is failure for the function. The supported interfaces are IFilterCondition and IAggregateFilterCondition (and the base classes IPersistStream, IPersist and IUnknown).


The SHCreateFilter function is exported from SHELL32.DLL as ordinal 818 in the version 6.00 from Windows Vista, and higher.

This function was not documented by Microsoft for the January 2007 edition of the Windows Vista Software Development Kit (SDK).