c#简单金三立视频服务器的调用

本文详细介绍了如何利用金三立视频服务器提供的DLL进行二次开发,包括连接服务器、设置时间、打开图像、设置及调试等内容。通过实例展示了如何在实际应用中灵活运用这些API实现视频监控系统的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1:引用金三立视频服务器提供的二次开发的DLL


2:申明

 [DllImport("videoDll.dll")]
        public static extern bool initNet();
        [DllImport("videoDll.dll")]
        public static extern long
        Dll_setInitServerInfo(string ip, int port, string userName, string passWord, ref ulong m_hUserID);


        [DllImport("videoDll.dll")]
        public static extern ulong
        Dll_PlayVideo(int channelID, int channel_Type, int protocol_type, IntPtr hwnd, ulong m_hUserID);
        [DllImport("videoDll.dll")]
        public static extern bool
        Dll_CloseVideo(int channelID, int channel_Type, ulong m_hPlayID);


        [DllImport("videoDll.dll")]
        public static extern void
        Dll_st_net_ptzControl(int channel, int type, int param, ulong user_id);
        [DllImport("videoDll.dll")]
        public static extern int
        Dll_st_net_setSystemTime(int year, int month, int day, int hour, int minute, int second, ulong user_id);
        [DllImport("videoDll.dll")]
        public static extern bool
        Dll_FreeServerInfo(ulong m_hUserID);

        [DllImport("kernel32")]
        private static extern bool WritePrivateProfileString(string section, string key, string val, string filePath);

        [DllImport("kernel32")]
        private static extern int GetPrivateProfileString(string section, string key, string def, byte[] retVal, int size, string filePath);
        [DllImport("kernel32.dll")]
        public static extern bool Beep(int frequency, int duration);


3:ip与端口,密码,与其他申明

   public const int WM_VIDEO = 0x500;
        int currentId = 0;
        private ulong m_hUserID = 0;
        private ulong m_hUserID1 = 0;

        private ulong m_hPlayID1 = 0;
        private ulong m_hPlayID2 = 0;

 string ipAdress = "192.168.1.100";
        const int port = 9660;
        string user = "Admin";
        string password = "123456";

(这种为最简单写死的模式,如果你在实际的开上不能这样干)

4:调用

1:连接

ipAdress = treeView1.SelectedNode.Nodes[1].Text;
                        user = treeView1.SelectedNode.Nodes[2].Text;
                        password = treeView1.SelectedNode.Nodes[3].Text;
                        ipAdress = ipAdress.Substring(5);
                        user = user.Substring(5);
                        password = password.Substring(3);

                        //连接金三立视频服务器
                        Dll_setInitServerInfo(ipAdress, port, user, password, ref m_hUserID);

2:设置时间

if (m_hUserID == 0)
                        {
 
                            currentPositon = "无";
                            return;
                        }
                        Dll_st_net_setSystemTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, m_hUserID);

3:打开图像

//通道1

this.m_hPlayID1 = Dll_PlayVideo(0, 0, 1, panel_left.Handle, m_hUserID);
  //通道2

 this.m_hPlayID2 = Dll_PlayVideo(1, 0, 1, panel2.Handle, m_hUserID);


4:设置

 this.m_hPlayID1 = Dll_PlayVideo(1, 0, 1, panel_left.Handle, m_hUserID);

5:调试

Dll_st_net_ptzControl(channel, 0x12, iDefaultPos, userId);

6:上,下,左,右

        private void ControlVideo(int type)
        {
            int channel = comboBox2.SelectedIndex;
            ulong userId = 0;
            if (this.formNum == 0)
            {

                userId = this.m_hUserID;

            }
            else
            {

                userId = this.m_hUserID1;

            }
            Dll_st_net_ptzControl(channel, type, speed, userId);
        }

上面就是是简单的用金三立服务器提供的DLL进行了简单的二次开发。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值