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
{
  [StructLayout(LayoutKind.Sequential)]
        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);
            }
 
        }
        [StructLayout(LayoutKind.Sequential)]
        public struct RGBQUAD
        {
            public byte b;
            public byte g;
            public byte r;
            public byte reserved;
        }
        [StructLayout(LayoutKind.Sequential)]
        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;
        }
        [StructLayout(LayoutKind.Sequential)]
        public struct VIDEOHEADER
        {
            public IntPtr lpData;
            public uint dwBufferLength;
            public uint dwBytesUsed;
            public uint dwTimeCaptured;
            public uint dwUser;
            public uint dwFlags;
            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.SafeArray)]
            byte[] dwReserved;
        }
        public class Avicap32
        {
/// <see cref="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_capgetdriverdescription.asp"/>
            [DllImport("avicap32.dll")]
            public extern static IntPtr capGetDriverDescription(ushort index, StringBuilder name, int nameCapacity, StringBuilder description, int descriptionCapacity);
 
            /// <see cref="http://msdn.microsoft.com/library/en-us/multimed/htm/_win32_capcreatecapturewindow.asp?frame=true"/>
            [DllImport("avicap32.dll")]
            public extern static IntPtr capCreateCaptureWindow(string title, uint style, int x, int y, int width, int height, IntPtr window, int id);
            /// <see cref="http://msdn.microsoft.com/library/en-us/multimed/htm/_win32_capcreatecapturewindow.asp?frame=true"/>
            [DllImport("avicap32.dll")]
            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
v8

1 solution

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

Solution 1

avicap32.dll does not has capGetVideoFormat definition.
  Permalink  

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