private void captureBtn_Click(object sender, EventArgs e) { SdkClass.NET_DVR_MANUALSNAP snap = new SdkClass.NET_DVR_MANUALSNAP(); SdkClass.NET_DVR_PLATE_RESULT result = new SdkClass.NET_DVR_PLATE_RESULT(); SdkClass.NET_DVR_ManualSnap(iUid, ref snap, ref result); if (result.dwPicLen > 0 && result.pBuffer4.ToInt32() != 0) { num++; string path = string.Format("{0}\\{1}.jpg", Directory.GetCurrentDirectory().ToString(), num.ToString()); FileStream filesave = new FileStream(path, FileMode.OpenOrCreate); byte[] _imageTemp = new byte[result.dwPicLen]; Marshal.Copy(result.pBuffer4, _imageTemp, 0, result.dwPicLen); filesave.Write(_imageTemp, 0, result.dwPicLen); filesave.Flush(); filesave.Close(); filesave = null; this.pictureBox1.Image = Image.FromFile(path); //settext(System.Text.Encoding.Default.GetString(result.struPlateInfo.sLicense)); settext(result.struPlateInfo.sLicense); } }
//回调函数,用来获取车辆数据 public void GetMessage(Int32 lCommand, ref SdkClass.NET_DVR_ALARMINFO_V30 pAlarmer, ref SdkClass.NET_DVR_PLATE_RESULT pAlarmInfo, Int32 dwBufLen, IntPtr pUser) { //智能高清IPC报警上传 if (lCommand == 0x2800) { try { if (pAlarmInfo.dwPicLen > 0 && pAlarmInfo.pBuffer1.ToInt32() != 0) { num++; string path = string.Format("{0}\\{1}.jpg", Directory.GetCurrentDirectory().ToString(), num.ToString()); FileStream filesave = new FileStream(path, FileMode.OpenOrCreate); byte[] _imageTemp = new byte[pAlarmInfo.dwPicLen]; Marshal.Copy(pAlarmInfo.pBuffer1, _imageTemp, 0, pAlarmInfo.dwPicLen); filesave.Write(_imageTemp, 0, pAlarmInfo.dwPicLen); filesave.Flush(); filesave.Close(); filesave = null; this.pictureBox1.Image = Image.FromFile(path); //settext(System.Text.Encoding.Default.GetString(pAlarmInfo.struPlateInfo.sLicense)); settext(pAlarmInfo.struPlateInfo.sLicense); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void captureBtn_Click(object sender, EventArgs e) { SdkClass.NET_DVR_MANUALSNAP snap = new SdkClass.NET_DVR_MANUALSNAP(); SdkClass.NET_DVR_PLATE_RESULT result = new SdkClass.NET_DVR_PLATE_RESULT(); SdkClass.NET_DVR_ManualSnap(iUid,ref snap, ref result); if (result.dwPicLen > 0 && result.pBuffer4.ToInt32() != 0) { num++; string path = string.Format("{0}\\{1}.jpg", Directory.GetCurrentDirectory().ToString(), num.ToString()); FileStream filesave = new FileStream(path, FileMode.OpenOrCreate); byte[] _imageTemp = new byte[result.dwPicLen]; Marshal.Copy(result.pBuffer4, _imageTemp, 0, result.dwPicLen); filesave.Write(_imageTemp, 0, result.dwPicLen); filesave.Flush(); filesave.Close(); filesave = null; this.pictureBox1.Image = Image.FromFile(path); //settext(System.Text.Encoding.Default.GetString(result.struPlateInfo.sLicense)); settext(result.struPlateInfo.sLicense); } }