监控视频的测试

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SIMUHKNETSDK;
namespace SIMUSDK
{
    public partial class Form1 : Form
    {
        private int m_videoHandle;//视频Handle
        private int m_userID;//当前用户ID
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            bool flag =SIMUHKNETSDK.SIMUHKNETSDK.NET_DVR_Init();
            int success = LoginVideo();
            if (success == -1)
            {
                groupBox1.Text = "用户登录[连接失败]";
            }
            else
            {
                groupBox1.Text = "用户登录[连接成功]";
            }
        }

        private int LoginVideo()
        {
            SIMUHKNETSDK.NET_DVR_DEVICEINFO serInfo = new SIMUHKNETSDK.NET_DVR_DEVICEINFO();
            m_userID = SIMUHKNETSDK.SIMUHKNETSDK.NET_DVR_Login(txtIP.Text, int.Parse(txtHost.Text), txtUserName.Text.ToString(), txtPassword.Text.ToString(), out serInfo);
            return m_userID;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            for (int i = 1; i <= 4; i++)
            {
                Panel panel = new Panel();
                NET_DVR_CLIENTINFO cli = new NET_DVR_CLIENTINFO();
                cli.lChannel = i;
                cli.lLinkMode = 0;
                cli.hPlayWnd = panel.Handle;
                panel.Dock = DockStyle.Fill;
                cli.sMultiCastIP = "0.0.0.0";
                tableLayoutPanel1.Controls.Add(panel);
                m_videoHandle =SIMUHKNETSDK.SIMUHKNETSDK.NET_DVR_RealPlay(m_userID, ref cli);
            }

        }
    }
}

 

 

posted @ 2012-06-28 16:06  在 水 一 方  阅读(1061)  评论(4编辑  收藏  举报