Example #1
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Turn off device notifications
            if (m_rdn != null)
            {
                m_rdn.Dispose();
                m_rdn = null;
            }

            // End any active captures
            if (m_pCapture != null)
            {
                m_pCapture.EndCaptureSession();
                m_pCapture = null;
            }

            // Shut down MF
            MFExtern.MFShutdown();
        }
Example #2
0
        public Form1()
        {
            InitializeComponent();

            int hr = 0;

            // Set the default output file name
            tbOutputFile.Text = "capture.mp4";

            // Register for device notifications as capture devices get added or removed
            m_rdn = new RegisterDeviceNotifications(this.Handle, KSCATEGORY_CAPTURE);

            // Init MF
            hr = MFExtern.MFStartup(0x00020070, MFStartup.Full);

            // Enumerate the video capture devices.
            if (hr >= 0)
            {
                // Populate the device list
                hr = UpdateDeviceList();
            }

            if (hr >= 0)
            {
                // Enable/disable ui controls
                UpdateUI();

                // If there are no capture devices
                if (cbDeviceList.Items.Count == 0)
                {
                    MessageBox.Show(
                        this,
                        "Could not find any video capture devices.",
                        Application.ProductName,
                        MessageBoxButtons.OK
                        );
                }
            }
        }
Example #3
0
        public Form1()
        {
            InitializeComponent();

            HResult hr = 0;

            // Set the default output file name
            tbOutputFile.Text = "capture.mp4";

            // Register for device notifications as capture devices get added or removed
            m_rdn = new RegisterDeviceNotifications(this.Handle, KSCATEGORY_CAPTURE);

            // Init MF
            hr = MFExtern.MFStartup(0x00020070, MFStartup.Full);

            // Enumerate the video capture devices.
            if (hr >= 0)
            {
                // Populate the device list
                hr = UpdateDeviceList();
            }

            if (hr >= 0)
            {
                // Enable/disable ui controls
                UpdateUI();

                // If there are no capture devices
                if (cbDeviceList.Items.Count == 0)
                {
                    MessageBox.Show(
                        this,
                        "Could not find any video capture devices.",
                        Application.ProductName,
                        MessageBoxButtons.OK
                        );
                }
            }
        }
Example #4
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Turn off device notifications
            if (m_rdn != null)
            {
                m_rdn.Dispose();
                m_rdn = null;
            }

            // End any active captures
            if (m_pCapture != null)
            {
                m_pCapture.EndCaptureSession();
                m_pCapture = null;
            }

            // Shut down MF
            MFExtern.MFShutdown();
        }