/// <summary> /// Returns the object as an ISpecificPropertyPage /// if the object supports the ISpecificPropertyPage /// interface and has at least one property page. /// </summary> protected bool AddIfSupported(object o, string name) { ISpecifyPropertyPages specifyPropertyPages = null; DsCAUUID pPages = new DsCAUUID(); bool wasAdded = false; // Determine if the object supports the interface // and has at least 1 property page try { specifyPropertyPages = o as ISpecifyPropertyPages; if (specifyPropertyPages != null) { int hr = specifyPropertyPages.GetPages(out pPages); if ((hr != 0) || (pPages.cElems <= 0)) { specifyPropertyPages = null; } } } finally { if (pPages.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(pPages.pElems); } } // Add the page to the internal collection if (specifyPropertyPages != null) { DirectShowPropertyPage p = new DirectShowPropertyPage(name, specifyPropertyPages); base.InnerList.Add(p); wasAdded = true; } return(wasAdded); }
/// <summary> /// Returns the object as an ISpecificPropertyPage /// if the object supports the ISpecificPropertyPage /// interface and has at least one property page. /// </summary> protected bool AddIfSupported(object o, string name) { ISpecifyPropertyPages specifyPropertyPages = null; DsCAUUID pPages = new DsCAUUID(); bool wasAdded = false; // Determine if the object supports the interface // and has at least 1 property page try { specifyPropertyPages = o as ISpecifyPropertyPages; if (specifyPropertyPages != null) { int hr = specifyPropertyPages.GetPages(out pPages); if ((hr != 0) || (pPages.cElems <= 0)) { specifyPropertyPages = null; } } } finally { if (pPages.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(pPages.pElems); } } // Add the page to the internal collection if (specifyPropertyPages != null) { DirectShowPropertyPage p = new DirectShowPropertyPage(name, specifyPropertyPages); base.InnerList.Add(p); wasAdded = true; } return wasAdded; }