如何使用capGetVideoFormat窗口表单 [英] how to use capGetVideoFormat window form

查看:334
本文介绍了如何使用capGetVideoFormat窗口表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中使用capGetVideoFormat和capSetVideoFormat方法。



我的代码是

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);
                   }
}





异常是''无法找到名为''capGetVideoFormat''的入口点DLL''avicap32.dll''。''



Exception is '' Unable to find an entry point named ''capGetVideoFormat'' in DLL ''avicap32.dll''.''

推荐答案

avicap32.dll没有capGetVideoFormat定义。
avicap32.dll does not has capGetVideoFormat definition.


这篇关于如何使用capGetVideoFormat窗口表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆