DALSA线阵CCD相机开发 之 MFC使用ini参数读取写入和去除相机参数载入界面

ini参数读取写入

ini文件如下:

[Database connection Info]
Middle_value=985.235000

ini参数读取:

::GetPrivateProfileStringW(_T("Database connection Info"), _T("Middle_value"), _T("没找到IP信息"), Middle_value.GetBuffer(MAX_PATH), MAX_PATH, _T("C:\\Program Files\\Teledyne DALSA\\Sapera\\Demos2\\Classes\\Vc\\GigeCameraDemo\\save.ini"));

ini参数写入,其中Middle_value为CString类:

::WritePrivateProfileStringW(_T("Database connection Info"), _T("Middle_value"), LPCWSTR(Middle_value), _T("C:\\Program Files\\Teledyne DALSA\\Sapera\\Demos2\\Classes\\Vc\\GigeCameraDemo\\save.ini"));

去除相机参数载入界面

CAcqConfigDlg为获取相机配置文件的类,使用之后会产生一个配置窗口选择相机以及相机的配置文件,以下代码可以去除次对话框,直接使用预定的相机和配置文件。

   // Select acquisition server from dialog
   // Only the servers that support "AcqDevice" resource are listed
   /*CAcqConfigDlg dlg(this, CAcqConfigDlg::ServerAcqDevice);
	if (dlg.DoModal() != IDOK)
   {
      MessageBox(_T("No GigE-Vision cameras found or selected"));
      EndDialog(TRUE);
      return FALSE;
   }*/
	// Define objects
    //m_AcqDevice	= new SapAcqDevice(dlg.GetLocation(), dlg.GetConfigFile());
	m_AcqDevice = new SapAcqDevice(SapLocation(CStringA(CString("Linea_M2048-7um_1")), 0),"C:\\Program Files\\Teledyne DALSA\\Sapera\\CamFiles\\User\\T_Linea_M2048-7um_Default_Default1.ccf");
	m_Buffers	= new SapBufferWithTrash(2, m_AcqDevice);
	m_Xfer		= new SapAcqDeviceToBuf(m_AcqDevice, m_Buffers, XferCallback, this);
	m_View      = new SapView(m_Buffers);

	// Create all objects
	if (!CreateObjects()) { EndDialog(TRUE); return FALSE; }
 	UpdateMenu();

你可能感兴趣的:(DALSA线阵CCD相机开发 之 MFC使用ini参数读取写入和去除相机参数载入界面)