void ExitSystem(void) { // RetCode_t r; bStartWorkFlag = false; r = XMS_acsCloseStream ( g_acsHandle, NULL ); // save to "config.txt" FetchFromText(); WriteToConfig(); }
void ExitSystem() { RetCode_t r; int i; // close all device for ( i = 0; i < g_iTotalModule; i ++ ) { CloseAllDevice_Dsp ( MapTable_Module[i] ); } r = XMS_acsCloseStream ( g_acsHandle, NULL ); FreeAllDeviceRes (); // save to "XMS_Demo.INI" FetchFromText(); WriteToConfig(); }
void SysConfigDlg::OnOK() { int iCarIndex; char tmpDataRecordPath[256]={0}; char tmpStr[3]; CString strTemp[16]; //获取当前选中文件保存路径 this->GetDlgItem ( IDC_EDIT_DATARECORD_PATH )->GetWindowText( tmpDataRecordPath, 256 ); //数据保存路径 strcpy(cfg_DataRecordPath,tmpDataRecordPath); WriteToConfig(); //获取当前选中的串口值 ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_A1))->GetWindowText(strTemp[0]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_A2))->GetWindowText(strTemp[1]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_A3))->GetWindowText(strTemp[2]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_A4))->GetWindowText(strTemp[3]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_B1))->GetWindowText(strTemp[4]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_B2))->GetWindowText(strTemp[5]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_B3))->GetWindowText(strTemp[6]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_B4))->GetWindowText(strTemp[7]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_C1))->GetWindowText(strTemp[8]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_C2))->GetWindowText(strTemp[9]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_C3))->GetWindowText(strTemp[10]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_C4))->GetWindowText(strTemp[11]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_D1))->GetWindowText(strTemp[12]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_D2))->GetWindowText(strTemp[13]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_D3))->GetWindowText(strTemp[14]); ((CComboBox*)GetDlgItem(IDC_COMBO_COMLIST_D4))->GetWindowText(strTemp[15]); //判断,选中串口不能相同 for(int i=0;i<16;i++) { for(int j=0;j<16;j++) { if(i!=j && !strTemp[i].IsEmpty() && !strTemp[j].IsEmpty() && strTemp[i]==strTemp[j]) { AfxMessageBox("同一个串口只能选中一次!"); return; } } } //选中串口赋值到全局结构体g_AllCar for(iCarIndex=0; iCarIndex<MAX_CAR_COUNT; iCarIndex++) { if(!strTemp[iCarIndex].IsEmpty()) { strcpy(tmpStr, strTemp[iCarIndex].Mid(3)); sscanf(tmpStr, "%d",&g_AllCar[iCarIndex].m_ComID); }else { g_AllCar[iCarIndex].m_ComID=0; } } cfg_EnableBeep = ((CButton *)this->GetDlgItem (IDC_CHECK_ENABLEBEEP))->GetCheck ( ) ; cfg_EnableLight = ((CButton *)this->GetDlgItem (IDC_CHECK_ENABLELIGHT))->GetCheck ( ) ; CDialog::OnOK(); }