首页 | 麦客学吧 | 视频教程 | FLASH小游戏 | 素材下载 | 常用工具
您当前的位置:首页 > 程序开发 > C# > 正文

捕捉摄相头的数据流

出处:麦客学吧 [2007-6-28 17:52:48] 作者:佚名 点击数:180

讨论交流:http://x8.maicoo.com/team/8789.html

         没什么好说的了,我把代码都贴出来,大家自己看吧!
webcam类的代码: 
using System;
using System.Runtime.InteropServices;

namespace webcam
{
    /**////
    /// avicap 的摘要说明。
    ///
    public class showVideo
    {
        // showVideo calls
        [DllImport("avicap32.dll")] public static extern IntPtr capCreateCaptureWindowA(byte[] lpszWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, int nID);
        [DllImport("avicap32.dll")] public static extern bool capGetDriverDescriptionA(short wDriver, byte[] lpszName, int cbName, byte[] lpszVer, int cbVer);
        [DllImport("User32.dll")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParam);
        [DllImport("User32.dll")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, int lParam);
        [DllImport("User32.dll")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, FrameEventHandler lParam);
        [DllImport("User32.dll")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref BITMAPINFO lParam);
        [DllImport("User32.dll")] public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
        [DllImport("avicap32.dll")]public static extern int capGetVideoFormat(IntPtr hWnd, IntPtr psVideoFormat, int wSize );

        // Constants
        public const int WM_USER = 0x400;
        public const int WS_CHILD = 0x40000000;
        public const int WS_VISIBLE = 0x10000000;
        public const int SWP_NOMOVE = 0x2;
        public const int SWP_NOZORDER = 0x4;
        public const int WM_CAP_DRIVER_CONNECT = WM_USER + 10;
        public const int WM_CAP_DRIVER_DISCONNECT = WM_USER + 11;
        public const int WM_CAP_SET_CALLBACK_FRAME = WM_USER + 5;
        public const int WM_CAP_SET_PREVIEW = WM_USER + 50;
        public const int WM_CAP_SET_PREVIEWRATE = WM_USER + 52;
        public const int WM_CAP_SET_VIDEOFORMAT = WM_USER + 45;
 
        // Structures
        [StructLayout(LayoutKind.Sequential)] public struct VIDEOHDR
        {
            [MarshalAs(UnmanagedType.I4)] public int lpData;
            [MarshalAs(UnmanagedType.I4)] public int dwBufferLength;
            [MarshalAs(UnmanagedType.I4)] public int dwBytesUsed;
            [MarshalAs(UnmanagedType.I4)] public int dwTimeCaptured;
            [MarshalAs(UnmanagedType.I4)] public int dwUser;
            [MarshalAs(UnmanagedType.I4)] public int dwFlags;
        &n

【责任编辑: lanier

关于 捕捉摄相头的数据流 的相关文章
素材中心
麦客酷站赏析频道

精彩图文推荐

关于本站 - 联系站长 - 广告服务 - 合作伙伴 - 网站地图 - 版权声明 - 报告错误 - 收藏本站 | Http://www.MaiCoo.com

Copyright © 2005 - 2008 MaiCoo.com All Rights Reserved

违法和不良信息举报中心 本站服务器空间和带宽由雷克斯网络提供赞助
浙ICP备06017818号