private void ProcessCommAlarm_Plate(ref HKSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser) { try { HKSDK.NET_DVR_PLATE_RESULT struPlateResultInfo = new HKSDK.NET_DVR_PLATE_RESULT(); uint dwSize = (uint)Marshal.SizeOf(struPlateResultInfo); struPlateResultInfo = (HKSDK.NET_DVR_PLATE_RESULT)Marshal.PtrToStructure(pAlarmInfo, typeof(HKSDK.NET_DVR_PLATE_RESULT)); if (struPlateResultInfo.byResultType == 1 && struPlateResultInfo.dwPicLen > 0) { byte[] by = new byte[struPlateResultInfo.dwPicLen]; Marshal.Copy(struPlateResultInfo.pBuffer1, by, 0, (int)struPlateResultInfo.dwPicLen); MemoryStream ms = new MemoryStream(by, 0, (int)struPlateResultInfo.dwPicLen); Image returnImage = Image.FromStream(ms); pictureBox1.Image = returnImage; if (filepath.Text != "") { returnImage.Save(filepath.Text + vehnum.ToString() + ".jpg"); vehnum++; } } } catch (System.Exception ex) { } }
private void ProcessCommAlarm_Plate(ref HKSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser) { try { HKSDK.NET_DVR_PLATE_RESULT struPlateResultInfo = new HKSDK.NET_DVR_PLATE_RESULT(); uint dwSize = (uint)Marshal.SizeOf(struPlateResultInfo); struPlateResultInfo = (HKSDK.NET_DVR_PLATE_RESULT)Marshal.PtrToStructure(pAlarmInfo, typeof(HKSDK.NET_DVR_PLATE_RESULT)); if (struPlateResultInfo.byResultType == 1&&struPlateResultInfo.dwPicLen>0) { byte[] by = new byte[struPlateResultInfo.dwPicLen]; Marshal.Copy(struPlateResultInfo.pBuffer1, by, 0, (int)struPlateResultInfo.dwPicLen); MemoryStream ms = new MemoryStream(by, 0, (int)struPlateResultInfo.dwPicLen); Image returnImage = Image.FromStream(ms); pictureBox1.Image = returnImage; if (filepath.Text != "") { returnImage.Save(filepath.Text+vehnum.ToString()+".jpg"); vehnum++; } } } catch (System.Exception ex) { } }