• 大小: 707KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-20
  • 语言: C#
  • 标签: 采集卡  C#  

资源简介

采集卡的C#Demo,不好找啊。。。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace WindowsApplication1
{
    public delegate bool BeginCapture(Int32 hBoard);
    public delegate void Display(Int32 hBoard Int32 no);
    public delegate bool EndCapture(Int32 hBoard);


    public partial class JHIImageBoardDemo : Form
    {
        okapi32 okApi;
        private Int32 IsSaveSeq;//1-beg2-con3-end
        private bool IsSaveImg = false;
        private bool IsConvertRect = true;
        private bool IsCapturing = false;
        public long TotalNo = 0;
        public  static bool bSaveSeq = false;
        private Bitmap _bufferImage;
        public static Int32 width = 0;
        public static Int32 height = 0;
        public static Int32 Stride = 0;
        public static Int32 PixelFormat = 0;
        public static Rectangle rect = new Rectangle();
        public static PictureBox mShowBox;
        private int SC_MINIMIZE = 0xF020;//define for min windows size
        static BeginCapture BeginCap;
        static Display DispCap;
        static EndCapture EndCap;
        protected override void WndProc(ref   Message m)
        {
            if (m.WParam.ToInt32() == SC_MINIMIZE)   //   minimize   message   
            {
                IsConvertRect = false;
                //m.Result = new IntPtr(0);   //   Take   care   of   message   
                //this.Hide();   //   Hide   the   form   
            }
            else //   Else...
            {
                IsConvertRect = true;
            }
            base.WndProc(ref m);//   ...let   Form   take   care   of   this   message   (normally)   
        }   

        public JHIImageBoardDemo()
        {
            Control.CheckForIllegalCrossThreadCalls = false;
            TotalNo = 0;
            InitializeComponent();
            okApi = new okapi32();
            mShowBox = this.ShowBox;
        }

        unsafe private void btnBeginCapt_Click(object sender EventArgs e)
        {
            string MsgBox;
            Int32 Ret = 0;
            string filename = “c:\\1.avi“;//要保存文件的文件名,.net 使用unicode编码
            char[] szFilenameW = filename.ToCharArray();//“unicode“
            //把unicode 转为ascii编码
            byte[] szFilename = Encoding.GetEncoding(“ASCII“).GetBytes(szFilenameW);
         
            BeginCap = new BeginCapture(JHIImageBoardDemo.BCapture);
            DispCap = new Display(JHIImageBoardDemo.DCapture);
            EndCap = new EndCapture(JHIImageBoardDemo.ECapture);

            Int32 OutputFreq = 0;

            bSaveSeq = chkSaveSeq.Checked;
            if( okApi.hBoard<=0)
            {
                //if not exist display show msg on ShowBox
                MsgBox = “采集卡错误“;
                LabelMsgBox.Text = MsgBox;
                return;
            }
            else{}//do ne

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-03-06 09:53  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\
     目录           0  2015-03-06 09:53  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\_UpgradeReport_Files\
     文件        3348  2014-05-15 16:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\_UpgradeReport_Files\UpgradeReport.css
     文件       12505  2010-05-04 08:19  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\_UpgradeReport_Files\UpgradeReport.xslt
     文件          69  2014-05-15 16:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\_UpgradeReport_Files\UpgradeReport_Minus.gif
     文件          71  2014-05-15 16:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\_UpgradeReport_Files\UpgradeReport_Plus.gif
     文件        1657  2015-07-17 14:09  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\SimpleDisplayCapture.sln
     文件       47616  2015-07-17 16:07  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\SimpleDisplayCapture.suo
     文件        5873  2014-05-15 16:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\UpgradeLog.xml
     目录           0  2015-07-17 13:50  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\
     文件         144  2014-05-16 15:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\app.config
     目录           0  2015-07-17 14:09  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\
     目录           0  2015-03-06 10:12  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Debug\
     文件       40960  2015-03-06 10:12  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Debug\WindowsApplication1.exe
     文件         144  2014-05-16 15:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Debug\WindowsApplication1.exe.config
     文件       48640  2015-03-06 10:12  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Debug\WindowsApplication1.pdb
     文件        5632  2005-12-08 14:51  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe
     文件         144  2014-05-16 15:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe.config
     目录           0  2015-07-17 14:06  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\
     文件         122  2015-03-06 10:09  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\check_usb30.txt
     文件      460800  2014-10-28 09:41  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\OKAPI32.dll
     文件       28672  2015-07-17 14:06  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\WindowsApplication1.exe
     文件         144  2014-05-16 15:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\WindowsApplication1.exe.config
     文件       36352  2015-07-17 14:06  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\WindowsApplication1.pdb
     文件       11592  2015-07-17 14:08  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\WindowsApplication1.vshost.exe
     文件         144  2014-05-16 15:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\WindowsApplication1.vshost.exe.config
     文件         490  2013-06-18 20:28  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\Release\WindowsApplication1.vshost.exe.manifest
     目录           0  2015-03-06 09:53  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\x64\
     目录           0  2015-03-06 09:53  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\x64\Debug\
     文件       28160  2014-06-10 09:23  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\x64\Debug\WindowsApplication1.exe
     文件         144  2014-05-16 15:43  SimpleDisplayCapture(vs2010 x32\SimpleDisplayCapture\WindowsApplication1\bin\x64\Debug\WindowsApplication1.exe.config
............此处省略95个文件信息

评论

共有 条评论