private void CameraGrabberSaveImageComplete2( IntPtr Grabber, IntPtr Image, // 需要调用CameraImage_Destroy释放 CameraSdkStatus Status, IntPtr Context) { if (Image != IntPtr.Zero) { tSdkCameraDevInfo devInfo; MvApi.CameraGrabber_GetCameraDevInfo(Grabber, out devInfo); Encoding myEncoding = Encoding.GetEncoding("utf-8"); string sData = myEncoding.GetString(devInfo.acSn); sData = sData.TrimEnd('\0'); sData = sData.Substring(0, 12); string filename = System.IO.Path.Combine( AppDomain.CurrentDomain.BaseDirectory.ToString(), string.Format("{0}-{1}-{2}.jpg", System.Environment.TickCount, sData, devInfo.uInstance)); MvApi.CameraImage_SaveAsJpeg(Image, filename, 90); m_saveFilenames += filename + "\r\n"; m_countFiles++; } if (m_countFiles == CAMERA_NUM) { MessageBox.Show(m_saveFilenames); } MvApi.CameraImage_Destroy(Image); }