// ---------------- Public Methods -------------------- /// <summary> /// Show the property page. Some property pages cannot be displayed /// while previewing and/or capturing. /// </summary> public override void Show(Control owner) { DsCAUUID cauuid = new DsCAUUID(); try { int hr = specifyPropertyPages.GetPages(out cauuid); if (hr != 0) { Marshal.ThrowExceptionForHR(hr); } object o = specifyPropertyPages; hr = OleCreatePropertyFrame(owner.Handle, 30, 30, null, 1, ref o, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero); DsError.ThrowExceptionForHR(hr); } catch (Exception) { MessageBox.Show("This filter has no property page!"); } finally { if (cauuid.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(cauuid.pElems); } } }
/// <summary> /// 视频属性页设置 /// 原生方式 /// </summary> public void changeCameraSetting(IntPtr Handle) { DsCAUUID cauuid = new DsCAUUID(); try { specifyPropertyPages = theDevice as ISpecifyPropertyPages; if (specifyPropertyPages == null) { MessageBox.Show("请先打开视频设备!"); return; } //返回filter所支持的属性页的CLSID int hr = specifyPropertyPages.GetPages(out cauuid); if (hr != 0) { Marshal.ThrowExceptionForHR(hr); } object o = specifyPropertyPages; //获取属性页 hr = OleCreatePropertyFrame(Handle, 30, 30, null, 1, ref o, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero); } catch (Exception ex) { MessageBox.Show("Unable display property page. Please submit a bug report.\n\n" + ex.Message + "\n\n" + ex.ToString()); } }
// Token: 0x06000350 RID: 848 RVA: 0x00013FF8 File Offset: 0x000121F8 protected bool addIfSupported(object o, string name) { ISpecifyPropertyPages specifyPropertyPages = null; DsCAUUID dsCAUUID = default(DsCAUUID); bool result = false; try { specifyPropertyPages = (o as ISpecifyPropertyPages); if (specifyPropertyPages != null) { int pages = specifyPropertyPages.GetPages(ref dsCAUUID); if (pages != 0 || dsCAUUID.cElems <= 0) { specifyPropertyPages = null; } } } finally { if (dsCAUUID.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(dsCAUUID.pElems); } } if (specifyPropertyPages != null) { DirectShowPropertyPage value = new DirectShowPropertyPage(name, specifyPropertyPages); this.InnerList.Add(value); result = true; } return(result); }
protected bool addIfSupported(object o, string name) { ISpecifyPropertyPages specifyPropertyPages = null; DsCAUUID pPages = new DsCAUUID(); bool flag = false; try { specifyPropertyPages = o as ISpecifyPropertyPages; if ((specifyPropertyPages != null) && ((specifyPropertyPages.GetPages(out pPages) != 0) || (pPages.cElems <= 0))) { specifyPropertyPages = null; } } finally { if (pPages.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(pPages.pElems); } } if (specifyPropertyPages != null) { DirectShowPropertyPage page = new DirectShowPropertyPage(name, specifyPropertyPages); base.InnerList.Add(page); flag = true; } return(flag); }
public static bool ShowTunerPinDialog(ICaptureGraphBuilder2 bld, IBaseFilter flt, IntPtr hwnd) { int hr; object comObj = null; ISpecifyPropertyPages spec = null; DsCAUUID cauuid = new DsCAUUID(); try { DsGuid cat = PinCategory.Capture; DsGuid type = MediaType.Interleaved; DsGuid iid = typeof(IAMTVTuner).GUID; hr = bld.FindInterface(cat, type, flt, iid, out comObj); if (hr != 0) { type = MediaType.Video; hr = bld.FindInterface(cat, type, flt, iid, out comObj); if (hr != 0) { return(false); } } spec = comObj as ISpecifyPropertyPages; if (spec == null) { return(false); } hr = spec.GetPages(out cauuid); hr = OleCreatePropertyFrame(hwnd, 30, 30, null, 1, ref comObj, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero); return(true); } catch (Exception ee) { Trace.WriteLine("!Ds.NET: ShowCapPinDialog " + ee.Message); return(false); } finally { if (cauuid.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(cauuid.pElems); } spec = null; if (comObj != null) { Marshal.ReleaseComObject(comObj); } comObj = null; } }
public void TestGetPages() { int hr = 0; FilterInfo filterInfo; DsCAUUID pages = new DsCAUUID(); try { // Just to retrieve the name of the filter hr = this.filter.QueryFilterInfo(out filterInfo); DsError.ThrowExceptionForHR(hr); // An exception is thrown if the cast is imposible ISpecifyPropertyPages propertyPages = (ISpecifyPropertyPages)this.filter; // Query PerperyPages Guid hr = propertyPages.GetPages(out pages); DsError.ThrowExceptionForHR(hr); object obj = (object)this.filter; // Display the property window hr = OleCreatePropertyFrame( IntPtr.Zero, 0, 0, filterInfo.achName, 1, ref obj, pages.cElems, pages.pElems, 0, 0, IntPtr.Zero ); DsError.ThrowExceptionForHR(hr); } finally { // pElems memory must be freed if (pages.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(pages.pElems); } } }
public static bool ShowTunerPinDialog( ICaptureGraphBuilder2 bld, IBaseFilter flt, IntPtr hwnd ) { int hr; object comObj = null; ISpecifyPropertyPages spec = null; DsCAUUID cauuid = new DsCAUUID(); try { DsGuid cat = PinCategory.Capture; DsGuid type = MediaType.Interleaved; DsGuid iid = typeof(IAMTVTuner).GUID; hr = bld.FindInterface( cat, type, flt, iid, out comObj ); if( hr != 0 ) { type = MediaType.Video; hr = bld.FindInterface( cat, type, flt, iid, out comObj ); if( hr != 0 ) return false; } spec = comObj as ISpecifyPropertyPages; if( spec == null ) return false; hr = spec.GetPages( out cauuid ); hr = OleCreatePropertyFrame( hwnd, 30, 30, null, 1, ref comObj, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero ); return true; } catch( Exception ee ) { Trace.WriteLine( "!Ds.NET: ShowCapPinDialog " + ee.Message ); return false; } finally { if( cauuid.pElems != IntPtr.Zero ) Marshal.FreeCoTaskMem( cauuid.pElems ); spec = null; if( comObj != null ) Marshal.ReleaseComObject( comObj ); comObj = null; } }
// Token: 0x060001A9 RID: 425 RVA: 0x000125F4 File Offset: 0x000107F4 public override void Show(Control owner) { DsCAUUID dsCAUUID = default(DsCAUUID); try { int num = this.specifyPropertyPages.GetPages(ref dsCAUUID); object obj = this.specifyPropertyPages; num = DirectShowPropertyPage.OleCreatePropertyFrame(owner.Handle, 30, 30, null, 1, ref obj, dsCAUUID.cElems, dsCAUUID.pElems, 0, 0, IntPtr.Zero); } finally { if (dsCAUUID.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(dsCAUUID.pElems); } } }
/// <summary> /// Show the property page. Some property pages cannot be displayed /// while previewing and/or capturing. /// </summary> public override void Show(Control owner) { DsCAUUID cauuid = new DsCAUUID(); try { int hr = specifyPropertyPages.GetPages(out cauuid); Marshal.ThrowExceptionForHR(hr); object o = specifyPropertyPages; hr = OleCreatePropertyFrame(owner.Handle, 30, 30, null, 1, ref o, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero); } finally { if (cauuid.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(cauuid.pElems); } } }
public override void Show(Control owner) { DsCAUUID pPages = new DsCAUUID(); try { int pages = this.specifyPropertyPages.GetPages(out pPages); if (pages != 0) { Marshal.ThrowExceptionForHR(pages); } object specifyPropertyPages = this.specifyPropertyPages; pages = OleCreatePropertyFrame(owner.Handle, 30, 30, null, 1, ref specifyPropertyPages, pPages.cElems, pPages.pElems, 0, 0, IntPtr.Zero); } finally { if (pPages.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(pPages.pElems); } } }
public void Show(IntPtr hWnd) { var cauuid = new DsCAUUID(); try { int hr = m_specifyPropertyPages.GetPages(out cauuid); if (hr != 0) { Marshal.ThrowExceptionForHR(hr); } object objRef = m_specifyPropertyPages; hr = OleCreatePropertyFrame(hWnd, 30, 30, null, 1, ref objRef, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero); DsError.ThrowExceptionForHR(hr); } catch (Exception) { MessageBox.Show(NO_PROPERTY_PAGE_FOUND); } finally { if (cauuid.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(cauuid.pElems); } } }
/// <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 cauuid = 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 cauuid); if ((hr != 0) || (cauuid.cElems <= 0)) { specifyPropertyPages = null; } } } finally { if (cauuid.pElems != IntPtr.Zero) { Marshal.FreeCoTaskMem(cauuid.pElems); } } // Add the page to the internal collection if (specifyPropertyPages != null) { DirectShowPropertyPage p = new DirectShowPropertyPage(name, specifyPropertyPages); InnerList.Add(p); wasAdded = true; } return(wasAdded); }
public void ShowPropertyPage(IntPtr parentWindowHandle) { if (Clsid == Guid.Empty) { //We don't have a CLSID for this filter, so there's no way we can create it throw new InvalidOperationException("You cannot display the property page for a filter with no CLSID"); } Type filterType = Type.GetTypeFromCLSID(Clsid); Object filterObj = null; try { filterObj = System.Activator.CreateInstance(filterType); } catch (FileNotFoundException e) { throw new ApplicationException( String.Format("Unable to display property page for this filter because the filter DLL '{0}' was not found", FilePath), e); } IBaseFilter filter = (IBaseFilter)filterObj; ISpecifyPropertyPages propPages; try { propPages = (ISpecifyPropertyPages)filterObj; } catch (InvalidCastException e) { throw new NotSupportedException("This filter does not support property pages", e); } DsCAUUID pages = new DsCAUUID(); int hr = propPages.GetPages(out pages); DsError.ThrowExceptionForHR(hr); try { hr = Utils.Com.OleCreatePropertyFrame(parentWindowHandle, 0, 0, FriendlyName, 1, new object[] { filter }, (uint)pages.cElems, pages.ToGuidArray(), 0, 0, IntPtr.Zero); DsError.ThrowExceptionForHR(hr); } finally { Marshal.FreeCoTaskMem(pages.pElems); } }