Click here to Skip to main content
12,444,748 members (55,576 online)
Rate this:
Please Sign up or sign in to vote.
See more: VS2008 C# Visual-Studio
I want to use capGetVideoFormat and capSetVideoFormat method in my application.

My code is
public class Class1
        public struct BITMAPINFOHEADER
            public uint biSize;
            public int biWidth;
            public int biHeight;
            public ushort biPlanes;
            public ushort biBitCount;
            public uint biCompression;
            public uint biSizeImage;
            public int biXPelsPerMeter;
            public int biYPelsPerMeter;
            public uint biClrUsed;
            public uint biClrImportant;
            public void Init()
                biSize = (uint)Marshal.SizeOf(this);
        public struct RGBQUAD
            public byte b;
            public byte g;
            public byte r;
            public byte reserved;
        public struct BITMAPINFO
            // [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 1)]
            public BITMAPINFOHEADER bmiHeader;
            [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 1)]
            public RGBQUAD[] bmiColors;
        public struct VIDEOHEADER
            public IntPtr lpData;
            public uint dwBufferLength;
            public uint dwBytesUsed;
            public uint dwTimeCaptured;
            public uint dwUser;
            public uint dwFlags;
            byte[] dwReserved;
        public class Avicap32
/// <see cref=""/>
            public extern static IntPtr capGetDriverDescription(ushort index, StringBuilder name, int nameCapacity, StringBuilder description, int descriptionCapacity);
            /// <see cref=""/>
            public extern static IntPtr capCreateCaptureWindow(string title, uint style, int x, int y, int width, int height, IntPtr window, int id);
            /// <see cref=""/>
            public extern static bool capDriverGetName(IntPtr deviceHandle, StringBuilder Drivername, byte size);
            [DllImport("avicap32.dll", EntryPoint = "capGetVideoFormat")]
            public extern static UInt32 capGetVideoFormat(IntPtr deviceHandle,ref BITMAPINFO m_bitmapinfo, byte size);
            [DllImport("avicap32.dll", EntryPoint = "capSetVideoFormat")]
            public extern static bool capSetVideoFormat(IntPtr deviceHandle,ref BITMAPINFO m_bitmapinfo, byte size);

  public class CaptureDevice
   public void Attach(System.Windows.Forms.Control control)
            deviceHandle = Class1.Avicap32.capCreateCaptureWindow("", Class1.Constants.WS_VISIBLE | Class1.Constants.WS_CHILD, 0, 0, control.Width, control.Height, control.Handle, 0);
Class1.BITMAPINFO bmi = new Class1.BITMAPINFO();
            Class1.Avicap32.capGetVideoFormat(deviceHandle, ref bmi, wSize);

Exception is ' Unable to find an entry point named 'capGetVideoFormat' in DLL 'avicap32.dll'.'
Posted 4-Mar-13 22:54pm
Updated 11-Mar-13 23:25pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

avicap32.dll does not has capGetVideoFormat definition.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100