Ejemplo n.º 1
0
        /// <summary>
        /// Gets managed data from a clipboard DataObject.
        /// </summary>
        /// <param name="dataObject">The DataObject to obtain the data from.</param>
        /// <param name="format">The format for which to get the data in.</param>
        /// <returns>The data object instance.</returns>
        public static object GetDataEx(this System.Windows.Forms.IDataObject dataObject, string format)
        {
            // Get the data
            object data = dataObject.GetData(format, true);

            // If the data is a stream, we'll check to see if it
            // is stamped by us for custom marshaling
            if (data is Stream)
            {
                object data2 = ((IDataObject)dataObject).GetManagedData(format);
                if (data2 != null)
                {
                    return(data2);
                }
            }

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Capture the next frame from the video feed
        /// </summary>
        public Image GetNextFrame()
        {
            try
            {

                // get the next frame;
                SendMessage(mCapHwnd, WM_CAP_GET_FRAME, 0, 0);

                // copy the frame to the clipboard
                SendMessage(mCapHwnd, WM_CAP_COPY, 0, 0);

                //if (ImageCaptured != null)
                {
                    // get from the clipboard
                    tempObj = Clipboard.GetDataObject();
                    tempImg = (System.Drawing.Bitmap) tempObj.GetData(System.Windows.Forms.DataFormats.Bitmap);

                   // return tempImg.GetThumbnailImage(m_Width, m_Height, null, System.IntPtr.Zero);

                }

            }

            catch (Exception excep)
            {
                //MessageBox.Show("An error ocurred while capturing the video image. The video capture will now be terminated.\r\n\n" + excep.Message);
                //	this.Stop(); // stop the process
            }

            return tempImg;
        }