public static object CreateFilter( string filterMoniker )
{
// filter's object
object filterObject = null;
// bind context and moniker objects
IBindCtx bindCtx = null;
IMoniker moniker = null;
int n = 0;
// create bind context
if ( Win32.CreateBindCtx( 0, out bindCtx ) == 0 )
{
// convert moniker`s string to a moniker
if ( Win32.MkParseDisplayName( bindCtx, filterMoniker, ref n, out moniker ) == 0 )
{
// get device base filter
Guid filterId = typeof( IBaseFilter ).GUID;
moniker.BindToObject( null, null, ref filterId, out filterObject );
Marshal.ReleaseComObject( moniker );
}
Marshal.ReleaseComObject( bindCtx );
}
return filterObject;
}