コード例 #1
0
ファイル: Form1.cs プロジェクト: dusong7/--1
        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)
            {
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: nodreamnolove/-
        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)
             {

             }
        }