Пример #1
0
        /// <summary>
        /// Creates a Snapshot from a windowless control
        /// </summary>
        /// <param name="control">control that is being drawn to by the VMR7</param>
        public Snapshot(IVMRWindowlessControl control)
        {
            int hr;

            hr = control.GetCurrentImage(out _dib);
            DsError.ThrowExceptionForHR(hr);
        }
        public override bool GetCurrentImage(out BITMAPINFOHEADER header, out IntPtr dibFull, out IntPtr dibDataOnly)
        {
            int hr = _pVMRWindowlessControl.GetCurrentImage(out dibFull);

            if (DsHlp.SUCCEEDED(hr))
            {
                header      = (BITMAPINFOHEADER)Marshal.PtrToStructure(dibFull, typeof(BITMAPINFOHEADER));
                dibDataOnly = new IntPtr(dibFull.ToInt64() + Marshal.SizeOf(typeof(BITMAPINFOHEADER)));
                return(true);
            }
            else
            {
                header      = new BITMAPINFOHEADER();
                dibDataOnly = IntPtr.Zero;
                return(false);
            }
        }