求  c# 视频摄像 源代码 拍出来的照 大小,谢谢

解决方案 »

  1.   

            public delegate bool CallBack(int hwnd, int lParam);
            ///   <summary>   
            ///   必需的设计器变量。   
            ///   </summary>          
            [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern int capCreateCaptureWindowA([MarshalAs(UnmanagedType.VBByRefStr)]   ref   string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID);
            [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)]   ref   string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)]   ref   string lpszVer, int cbVer);
            [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern bool DestroyWindow(int hndw);
            [DllImport("user32", EntryPoint = "SendMessageA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)]   object lParam);
            [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
            [DllImport("vfw32.dll")]
            public static extern string capVideoStreamCallback(int hwnd, videohdr_tag videohdr_tag);
            [DllImport("vicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern bool capSetCallbackOnFrame(int hwnd, string s);
            private void OpenCapture()
            {
                int intWidth = this.panel1.Width;
                int intHeight = this.panel1.Height;
                int intDevice = 0;
                string refDevice = intDevice.ToString();
                //创建视频窗口并得到句柄
                hHwnd = CardReader.capCreateCaptureWindowA(ref   refDevice, 1342177280, 0, 0, 160, 120, this.panel1.Handle.ToInt32(), 0);
                if (CardReader.SendMessage(hHwnd, 0x40a, intDevice, 0) > 0)
                {
                    CardReader.SendMessage(this.hHwnd, 0x435, -1, 0);
                    CardReader.SendMessage(this.hHwnd, 0x434, 0x42, 0);
                    CardReader.SendMessage(this.hHwnd, 0x432, -1, 0);
                    CardReader.SetWindowPos(this.hHwnd, 1, 0, 0, intWidth, intHeight, 6);
                }
                else
                {
                    CardReader.DestroyWindow(this.hHwnd);
                    MessageBox.Show("加载视频失败,请检查是否有安装设备!", "拍照");            }
            }试试看 
      

  2.   

    C#.net编写摄像头驱动程序,用avicap32.dll
    http://blog.csdn.net/zzmdegm/article/details/1915364
    给分吧
      

  3.   

    求代码,不如先自己搜索一下。帮你搜索一下:http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&rlz=1I7GGLD_zh-CN&q=.net+%E6%91%84%E5%83%8F%E5%A4%B4&oq=.net+%E6%91%84%E5%83%8F%E5%A4%B4&aq=f&aqi=&aql=&gs_sm=e&gs_upl=73451l73617l0l74027l2l2l0l0l0l0l0l0ll0l0