private void DynnamicDecode_Load(object sender, EventArgs e)
        {
            if (!CHCNetSDK.NET_DVR_GetIPCProtoList(m_lUserID, ref m_struProtoList))
            {
                iLastErr = CHCNetSDK.NET_DVR_GetLastError();
                strErr   = "NET_DVR_GetIPCProtoList failed, error code= " + iLastErr;
                //获取设备支持的IPC协议表,输出错误号 Failed to get the IPC protocol list and output the error code
                MessageBox.Show(strErr);
            }
            else
            {
                for (int i = 0; i < (int)m_struProtoList.dwProtoNum; i++)
                {
                    comboBoxFactory.Items.Add(m_struProtoList.struProto[i].byDescribe);
                }
            }
            if (comboBoxFactory.Items.Count != 0)
            {
                comboBoxFactory.SelectedIndex = 0;
            }

            comboBoxStreamMode.SelectedIndex    = 0;
            comboBoxChanType.SelectedIndex      = 0;
            comboBoxTransType.SelectedIndex     = 0;
            comboBoxStreamType.SelectedIndex    = 0;
            comboBoxDomainType.SelectedIndex    = 0;
            comboBoxFactory_D.SelectedIndex     = 0;
            comboBoxChanType_D.SelectedIndex    = 0;
            comboBoxTransType_D.SelectedIndex   = 0;
            comboBoxStreamType_D.SelectedIndex  = 0;
            comboBoxSeverProcotol.SelectedIndex = 0;

            //获取通道信息
            btnChanInfo_Click(sender, e);
        }
        private void IPChannelConfig_Load(object sender, EventArgs e)
        {
            int i = 0;

            //获取设备支持IPC协议列表
            if (CHCNetSDK.NET_DVR_GetIPCProtoList(m_lUserID, ref m_struProtoList))
            {
                for (i = 0; i < (int)m_struProtoList.dwProtoNum; i++)
                {
                    comboBoxFactory.Items.Add(m_struProtoList.struProto[i].byDescribe);
                }
            }

            comboBoxStreamType.SelectedIndex = 0;
            comboBoxFactory.SelectedIndex    = 0;
            comboBoxStream.SelectedIndex     = 0;
            comboBoxProtocol.SelectedIndex   = 0;

            /***********************************************************
             * 显示当前IP通道配置
             * **********************************************************/
            if (iIPDevIndex < 0)
            {
                //该通道未添加有设备,空闲状态
                return;
            }

            comboBoxStreamType.SelectedIndex = m_struIPParaCfgV40.struStreamMode[iChanIndex].byGetStreamType;                       //取流方式
            textBoxIPAddr.Text   = System.Text.Encoding.UTF8.GetString(m_struIPParaCfgV40.struIPDevInfo[iIPDevIndex].struIP.sIpV4); //前端设备IP地址
            textBoxPort.Text     = Convert.ToString(m_struIPParaCfgV40.struIPDevInfo[iIPDevIndex].wDVRPort);                        //前端设备端口
            textBoxUserName.Text = System.Text.Encoding.UTF8.GetString(m_struIPParaCfgV40.struIPDevInfo[iIPDevIndex].sUserName);    //前端设备用户名
            textBoxPsw.Text      = System.Text.Encoding.UTF8.GetString(m_struIPParaCfgV40.struIPDevInfo[iIPDevIndex].sPassword);    //前端设备密码
            for (i = 0; i < (int)m_struProtoList.dwProtoNum; i++)
            {
                //设备(厂家)协议类型,通过NET_DVR_GetIPCProtoList获取
                if (m_struProtoList.struProto[i].dwType == m_struIPParaCfgV40.struIPDevInfo[iIPDevIndex].byProType)
                {
                    comboBoxFactory.SelectedIndex = i;
                }
            }

            switch (m_struIPParaCfgV40.struStreamMode[iChanIndex].byGetStreamType)
            {
            case 0:     //直接从设备取流,对应联合体中结构NET_DVR_IPCHANINFO
                IntPtr ptrChanInfo = Marshal.AllocHGlobal((Int32)dwUnionSize);
                Marshal.StructureToPtr(m_struIPParaCfgV40.struStreamMode[iChanIndex].uGetStream, ptrChanInfo, false);
                m_struChanInfo      = (CHCNetSDK.NET_DVR_IPCHANINFO)Marshal.PtrToStructure(ptrChanInfo, typeof(CHCNetSDK.NET_DVR_IPCHANINFO));
                textBoxChannel.Text = Convert.ToString(m_struChanInfo.byChannel);
                Marshal.FreeHGlobal(ptrChanInfo);
                break;

            case 6:    //直接从设备取流(扩展),对应联合体中结构NET_DVR_IPCHANINFO_V40
                IntPtr ptrChanInfoV40 = Marshal.AllocHGlobal((Int32)dwUnionSize);
                Marshal.StructureToPtr(m_struIPParaCfgV40.struStreamMode[iChanIndex].uGetStream, ptrChanInfoV40, false);
                m_struChanInfoV40              = (CHCNetSDK.NET_DVR_IPCHANINFO_V40)Marshal.PtrToStructure(ptrChanInfoV40, typeof(CHCNetSDK.NET_DVR_IPCHANINFO_V40));
                textBoxChannel.Text            = Convert.ToString(m_struChanInfoV40.dwChannel);
                comboBoxStream.SelectedIndex   = m_struChanInfoV40.byTransMode;
                comboBoxProtocol.SelectedIndex = m_struChanInfoV40.byTransProtocol;
                Marshal.FreeHGlobal(ptrChanInfoV40);
                break;

            default:
                break;
            }
        }