private void catchPictureToolStripMenuItem_Click(object sender, EventArgs e) { //return; if (m_nIndex > -1 && m_iPlayhandle > 0 && m_bSaveImageStart == false) { String strPath; DVR2Mjpeg DVR2Mjpeg = (DVR2Mjpeg)Parent; foreach (TreeNode node in DVR2Mjpeg.devForm.DevTree.Nodes) { if (node.Name == "Device") { foreach (TreeNode channelnode in node.Nodes) { if (channelnode.Name == "Channel") { CHANNEL_INFO chInfo = (CHANNEL_INFO)channelnode.Tag; if (chInfo.nWndIndex == m_nIndex) { strPath = String.Format(@"Z:\Pictures\bmp\{0}.bmp", m_nIndex + 1); bool bCatch = false; m_bSaveImageStart = true; try { if (DVR2Mjpeg.isConnected) { bCatch = XMSDK.H264_DVR_LocalCatchPic(m_iPlayhandle, strPath); } } catch (AccessViolationException ex) { Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss - ") + TAG + ".catchPictureToolStripMenuItem_Click.AccessViolationException", "DVR ERROR"); Debug.WriteLine(ex.ToString()); } catch (Exception ex) { Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss - ") + TAG + ".catchPictureToolStripMenuItem_Click.Exception", "DVR ERROR"); Debug.WriteLine(ex.ToString()); } m_bSaveImageStart = false; break; } } } } } } }