private void buttonSet_Click(object sender, EventArgs e) { int nIndex = this.comboBoxChannel.SelectedIndex;// m_ctlChannel.GetCurSel(); if (nIndex < 0) { return; } int nChn = nIndex;// m_ctlChannel.GetItemData(nIndex); IntPtr pSnapCfg = new IntPtr(); pSnapCfg = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DHDEV_SNAP_CFG)) * 32); for (int i = 0; i < 32; ++i) { Marshal.StructureToPtr(m_stuSnapCfg[i] , (IntPtr)((UInt32)pSnapCfg + i * Marshal.SizeOf(typeof(DHDEV_SNAP_CFG))), false); } bool bRet = DHClient.DHSetDevConfig(m_nLoginID, CONFIG_COMMAND.DH_DEV_SNAP_CFG, nChn, pSnapCfg, (UInt32)Marshal.SizeOf(typeof(DHDEV_SNAP_CFG)) * 32, 1000); if (!bRet) { //AfxMessageBox(ConvertString("Set snap configure failed!")); MessageBox.Show("保存抓图配置失败!"); } }