Ejemplo n.º 1
0
        private void Form1_Load( object sender, EventArgs e )
        {
            if ( !DsUtils.IsCorrectDirectXVersion() )
            {
              MessageBox.Show( this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop );
              this.Close(); return;
            }

            if ( !DsDev.GetDevicesOfCat( FilterCategory.VideoInputDevice, out capDevices ) )
            {
              MessageBox.Show( this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop );
              this.Close(); return;
            }

            DsDevice dev = null;
            if ( capDevices.Count == 1 )
              dev = capDevices[0] as DsDevice;
            else
            {
              DeviceSelector selector = new DeviceSelector( capDevices );
              selector.ShowDialog( this );
              dev = selector.SelectedDevice;
            }

            if ( dev == null )
            {
              this.Close(); return;
            }

            if ( !StartupVideo( dev.Mon ) )
              this.Close();

            CaptureImage();
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!DsUtils.IsCorrectDirectXVersion())
            {
                MessageBox.Show(this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            if (!DsDev.GetDevicesOfCat(FilterCategory.VideoInputDevice, out capDevices))
            {
                MessageBox.Show(this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            DsDevice dev = null;

            if (capDevices.Count == 1)
            {
                dev = capDevices[0] as DsDevice;
            }
            else
            {
                DeviceSelector selector = new DeviceSelector(capDevices);
                selector.ShowDialog(this);
                dev = selector.SelectedDevice;
            }

            if (dev == null)
            {
                this.Close(); return;
            }

            if (!StartupVideo(dev.Mon))
            {
                this.Close();
            }

            CaptureImage();
        }