private void OnMsgAddFaceParamCfgToList(ref Message m) { if (0 == m.LParam.ToInt64()) { //bFailedFaceInfo = false; IntPtr lpCardCfg = (IntPtr)m.WParam.ToInt64(); CHCNetSDK.NET_DVR_FACE_PARAM_CFG CardCfg = new CHCNetSDK.NET_DVR_FACE_PARAM_CFG(); CardCfg = (CHCNetSDK.NET_DVR_FACE_PARAM_CFG)Marshal.PtrToStructure(lpCardCfg, typeof(CHCNetSDK.NET_DVR_FACE_PARAM_CFG)); if (0 == CardCfg.dwSize) { return; } AddToFaceParamList(ref CardCfg); Marshal.FreeHGlobal(lpCardCfg); } else { //bFailedFaceInfo = true; IntPtr lpInfo = (IntPtr)m.WParam.ToInt64(); CHCNetSDK.NET_DVR_FAILED_FACE_INFO pInfo = new CHCNetSDK.NET_DVR_FAILED_FACE_INFO(); pInfo = (CHCNetSDK.NET_DVR_FAILED_FACE_INFO)Marshal.PtrToStructure(lpInfo, typeof(CHCNetSDK.NET_DVR_FAILED_FACE_INFO)); if (0 == pInfo.dwSize) { return; } AddToList(ref pInfo); Marshal.FreeHGlobal(lpInfo); } }
private void AddToList(ref CHCNetSDK.NET_DVR_FAILED_FACE_INFO struFailedFaceInfo) { int InsertIndex = listViewFaceConfig.Items.Count + 1; listViewFaceConfig.BeginUpdate(); ListViewItem item = new ListViewItem(); item.Text = InsertIndex.ToString(); string StrCardNo = System.Text.Encoding.Default.GetString(struFailedFaceInfo.byCardNo); item.SubItems.Add(StrCardNo); item.SubItems.Add("/"); item.SubItems.Add("/"); item.SubItems.Add("/"); item.SubItems.Add(struFailedFaceInfo.byErrorCode.ToString()); listViewFaceConfig.Items.Add(item); listViewFaceConfig.EndUpdate(); }