public static VIDEO_RESOLUTION GetVideoResolutionByIndex(uint resolutionIndex)
        {
            VIDEO_RESOLUTION videoResolution = new VIDEO_RESOLUTION();

            videoResolution.dwVersion = 1;
            videoResolution.bCustom   = 0;

            VIDEORESOLUTION resolution = (VIDEORESOLUTION)resolutionIndex;

            videoResolution.dwVideoResolution = (uint)resolution;
            string[] resolutions = resolution.ToString().Replace("VIDEORESOLUTION_", "").Split(new string[] { "x", "X" }, StringSplitOptions.None);
            if (resolutions.Length == 2)
            {
                videoResolution.dwWidth  = UInt32.Parse(resolutions[0]);
                videoResolution.dwHeight = UInt32.Parse(resolutions[1]);
            }

            return(videoResolution);
        }
        public static VIDEO_RESOLUTION GetVideoResolutionByWidthHeight(uint width, uint height)
        {
            VIDEO_RESOLUTION videoResolution = new VIDEO_RESOLUTION();

            videoResolution.dwVersion = 1;
            videoResolution.bCustom   = 0;

            string          resolutionName = "VIDEORESOLUTION_" + width + "X" + height;
            VIDEORESOLUTION resolution     = new VIDEORESOLUTION();

            if (Enum.TryParse <VIDEORESOLUTION>(resolutionName, out resolution))
            {
                videoResolution.dwVideoResolution = (uint)resolution;
                string[] resolutions = resolution.ToString().Replace("VIDEORESOLUTION_", "").Split(new string[] { "x", "X" }, StringSplitOptions.None);
                if (resolutions.Length == 2)
                {
                    videoResolution.dwWidth  = UInt32.Parse(resolutions[0]);
                    videoResolution.dwHeight = UInt32.Parse(resolutions[1]);
                }
            }
            return(videoResolution);
        }
 public static extern int AVerGetVideoResolutionEx(IntPtr hCaptureObject, ref VIDEO_RESOLUTION pVideoResolution);