private void CameraCapture_Load(object sender, System.EventArgs e)
        {
            var dict = CAP.ListDevices();

            if (dict.Count > 0)
            {
                menuDeviceSelect.DropDownItems.Clear();
                foreach (var key in dict.Keys)
                {
                    menuDeviceSelect.DropDownItems.Add(dict[key].Name, null, menuDeviceSelect_Click).Tag = key;
                }
            }

            _camera = new CaptureDevice(pictureCamera.Handle, pictureCamera.Width, pictureCamera.Height, 50, OnRecievedFrame);
            Start();
            _checker = new CheckBitmapForQR(OnByteArrayReceived);
        }
 public static Dictionary<short, CaptureDevice> ListDevices()
 {
     var lpszName = new byte[80];
     var lpszVersion = new byte[80];
     var list = new Dictionary<short, CaptureDevice>();
     for (short i = 0; i < 10; i++)
         if (capGetDriverDescriptionA(i, lpszName, 80, lpszVersion, 80))
         {
             var dev = new CaptureDevice() { Name = ConvertByteArrayToString(lpszName), Version = ConvertByteArrayToString(lpszVersion) };
             list.Add(i, dev);
         }
     return list;
 }