title: get filters(com devices) using DirectShow
body: <p>from <a href="http://www.codeproject.com/Articles/3566/DirectX-Capture-Class-Library" rel="nofollow">code project</a> I got this code but <strong>I don't understand</strong>.</p>
  
  <p>This function shall get all the filters(com devices) after its category and it fill it in the <strong>innerlist</strong></p>
  
  <p>can someone explain in details I have searched about each part all seems for me new 
  I don't understand what is <strong>ICreateDevEnum</strong> ,<strong>UCOMIEnumMoniker</strong>  and <strong>UCOMIMoniker</strong>
  and <strong>how we get the filters using them</strong></p>
  
  <pre><code>protected void getFilters(Guid category)
          {
              int                 hr;
              object              comObj = null;
              ICreateDevEnum      enumDev = null;
              UCOMIEnumMoniker    enumMon = null;
              UCOMIMoniker[]      mon = new UCOMIMoniker[1];
  
              try 
              {
                  // Get the system device enumerator
                  Type srvType = Type.GetTypeFromCLSID( Clsid.SystemDeviceEnum );
                  if( srvType == null )
                      throw new NotImplementedException( "System Device Enumerator" );
                  comObj = Activator.CreateInstance( srvType );
                  enumDev = (ICreateDevEnum) comObj;
  
                  // Create an enumerator to find filters in category
                  hr = enumDev.CreateClassEnumerator( ref category, out enumMon, 0 );
                  if( hr != 0 )
                      throw new NotSupportedException( "No devices of the category" );
  
                  // Loop through the enumerator
                  int f;
                  do
                  {
                      // Next filter
                      hr = enumMon.Next( 1, mon, out f );
                      if( (hr != 0) || (mon[0] == null) )
                          break;
  
                      // Add the filter
                      Filter filter = new Filter( mon[0] );
                      InnerList.Add( filter );
  
                      // Release resources
                      Marshal.ReleaseComObject( mon[0] );
                      mon[0] = null;
                  }
                  while(true);
  
                  // Sort
                  InnerList.Sort();
              }
              finally
              {
                  enumDev = null;
                  if( mon[0] != null )
                      Marshal.ReleaseComObject( mon[0] ); mon[0] = null;
                  if( enumMon != null )
                      Marshal.ReleaseComObject( enumMon ); enumMon = null;
                  if( comObj != null )
                      Marshal.ReleaseComObject( comObj ); comObj = null;
              }
          }
  </code></pre>