BOOL CChannelDatabaseAssociationDlg::OnInitDialog() { CDialog::OnInitDialog(); LVCOLUMN lvColumn; LVITEM lvItem; BYTE byCol; BYTE byItem; m_channelDatabaseAssociationListCtrl.SetExtendedStyle( LVS_EX_FULLROWSELECT ); lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvColumn.fmt = LVCFMT_LEFT; lvColumn.cx = 55; lvColumn.pszText = "Channel"; byCol = (BYTE)m_channelDatabaseAssociationListCtrl.InsertColumn(0, &lvColumn); lvColumn.cx = 567; lvColumn.pszText = "Database"; byCol = (BYTE)m_channelDatabaseAssociationListCtrl.InsertColumn(1, &lvColumn); lvItem.mask = LVIF_TEXT; lvItem.iSubItem = 0; CStringArray aomstrTempDBFiles; CStringArray aomstrTempChannels; (*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->vGetDataBaseNames(&aomstrTempDBFiles); (*(CMsgSignal**)(m_sDbParams.m_ppvImportedDBs))->vGetDatabaseChannels(&aomstrTempChannels); for(INT i = 1; i <= m_iNumberOfActiveChannels; i++) { CString tmpChannelNumber; tmpChannelNumber.Format("CAN%d", i); // Format the Bus-Name and Channel-Number lvItem.pszText = tmpChannelNumber.GetBuffer(0); // Convert to LPSTR tmpChannelNumber.ReleaseBuffer(); // Release the buffer directly lvItem.iItem = i; // item-position in table byItem = (BYTE)m_channelDatabaseAssociationListCtrl.InsertItem(&lvItem); // insert the new item } for(INT i = 0; i < m_iNumberOfActiveChannels; i++) { if(i > aomstrTempChannels.GetUpperBound()) { break; } int j = atoi(aomstrTempChannels[i]); m_channelDatabaseAssociationListCtrl.SetItemText(atoi(aomstrTempChannels[i]) - 1, 1, aomstrTempDBFiles[i]); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
inline BOOL CMyIENSHandle::PatternFilter(CString & url) { CString str, tmp, tmp2; try{ int i = 0, i2=0, start = 0, start2 = 0;//start - str, start2 - tmp BOOL cmode = TRUE; //compare mode; BOOL isame = FALSE; BOOL final = FALSE; int p = 0; while(p<=aUrlPattern.GetUpperBound() && !isame) { str = aUrlPattern.GetAt(p); //star filter i = 0; i2 = 0; start = 0; start2 = 0; isame = TRUE;cmode = TRUE;final = FALSE; while(start<str.GetLength() && isame) { //get the string before * i=str.Find('*', start); if(i<0) { tmp2 = str.Mid(start); i=str.GetLength(); final = TRUE; } else tmp2 = str.Mid(start,i-start); if(tmp2!="") { if(cmode) { tmp = url.Mid(start2, i-start); if(tmp != tmp2) isame = FALSE; } else if(final) { tmp = url.Right(tmp2.GetLength()); if(tmp != tmp2) isame = FALSE; } else { i2=url.Find(tmp2, start2); if( i2<0) isame = FALSE; } }
BOOL COptionsDlg::OnSetActive() { CSnmp *pSnmp = &theApp.m_wnd.snmp; if (pSnmp != NULL) { CStringArray s; CUIntArray nAdapterArray; pSnmp->GetInterfaceDescriptions(&s, &nAdapterArray); m_Interfaces.ResetContent(); int active = 0; for (int i = 0; i <= s.GetUpperBound(); i++) { int index = m_Interfaces.AddString(s.GetAt(i)); if (index != CB_ERR) { m_Interfaces.SetItemData(index, nAdapterArray.GetAt(i)); if (nAdapterArray.GetAt(i) == g_dwAdapter) active = i; } } m_Interfaces.SetCurSel(active); } return CPropertyPage::OnSetActive(); }
int CBase_AnalysisTemplate::Sample_PrepareAcquire(CBase_AnalysisSample *pcSample) { if(!pcSample) { return IAERROR_PARAMETER_WRONGTYPE; } CBase_AnalysisInstrument *pcInstru=NULL; BOOL bConnected=FALSE; for(int i=0; i<m_cArrayInstrument2Sample.GetCount(); ++i) { if(m_cArrayInstrument2Sample[i].m_pcSample==pcSample) { bConnected = TRUE; pcInstru = m_cArrayInstrument2Sample[i].m_pcInstrument; g_TracePersistentlyWithTime(_T("Sample_Prepare: CBase_AnalysisTemplate::Sample_PrepareAcquire(connected).\r\n")); break; } } if(!bConnected) pcInstru = GetInstrument(); if(pcInstru == NULL) return IAERROR_INSTRUMENT_NOTCONNECT; if(!pcInstru->Instrument_IsReady()) { //ALERT(ICON_CRITICAL, _T("仪器未连接"), _T("样品准备"), NULL); return IAERROR_INSTRUMENT_NOTCONNECT; } bool bNeedDownload = true; if(m_pcWindowTask) { CAnalysisTask* pTask = m_pcWindowTask->GetTask(); if(pTask) { const CAnalysisTaskItem* pItem = pTask->GetItem(pcSample); if(pItem && pItem->m_bUsingCurrentArgs) bNeedDownload = false; } } if(bNeedDownload) { //参数比较 //首先取得当前仪器参数 CString xmlString; if(pcInstru->Base_UploadFromDevice(xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY; CAnalysisData ad; if(ad.LoadFromDocument(xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY; //然后和样品中的参数进行比较 CAnalysisData& adSample = pcSample->m_data; CStringArray notequal; static CString sp(_T("Sample/Parameter/")); if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC_PX) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1120) == 0)) { static LPCTSTR vs[] = { _T("Instrument/MainFrame/Temp_ColumnBox"), _T("Instrument/MainFrame/Temp_FrontDetector"), _T("Instrument/MainFrame/Temp_RearDectetor"), _T("Instrument/MainFrame/Temp_FrontInjector"), _T("Instrument/MainFrame/Temp_RearInjector") }; for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]); } } else if(g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC2400) == 0) { static LPCTSTR vs[] = { _T("Instrument/MainFrame/Temp_ColumnBox"), _T("Instrument/MainFrame/Temp_FrontInjector"), _T("Instrument/MainFrame/Temp_RearDectetor") }; for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]); } } else if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100W) == 0)) { static LPCTSTR vs[] = { _T("Instrument/MainFrame/Temp_ColumnBox"), _T("Instrument/MainFrame/Temp_Detector") }; for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]); } } else if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100P) == 0)) { static LPCTSTR vs[] = { _T("Instrument/MainFrame/Temp_InputDetect"), _T("Instrument/MainFrame/Pressure"), _T("Instrument/MainFrame/Flow_ZQ"), _T("Instrument/MainFrame/Flow_WC") }; for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]); } } else if(g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_LC1620A) == 0) { static LPCTSTR vs[] = { _T("Instrument/Pump/InitFLowAPercent"), _T("Instrument/Pump/InitFLowBPercent"), _T("Instrument/Pump/InitFLow") }; for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]); } static LPCTSTR vs2[] = { _T("Instrument/UVDetector/WaveLength") }; for(int i=0; i<sizeof(vs2)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs2[i], ad, vs2[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs2[i]); } } else if(g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_IC1800) == 0) { static LPCTSTR vs[] = { _T("Instrument/Pump/InitFLow") }; for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]); } static LPCTSTR vs2[] = { _T("Instrument/Detector/Temp"), _T("Instrument/Detector/YZQDL")/*, _T("Instrument/Detector/Range")//*/ }; for(int i=0; i<sizeof(vs2)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs2[i], ad, vs2[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs2[i]); } static LPCTSTR vs3[] = { _T("Instrument/ColumnBox/Temp") }; for(int i=0; i<sizeof(vs3)/sizeof(LPCTSTR); ++i) { if(adSample.CompareValue_Double(sp + vs3[i], ad, vs3[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs3[i]); } } if(!notequal.IsEmpty()) { CString name, sv, cv, tr; // 弹出不同对话框 CString msg(_T("<table border='1'><tr><td>名称</td><td>样品参值</td><td>当前参值</td></tr>")); for(int i=0; i<=notequal.GetUpperBound(); ++i) { const CString& si = notequal.GetAt(i); adSample.GetProperty(sp + si, XMLPROP_NAME, name); adSample.GetValue_String(sp + si, sv); if((ad.GetValue_String(si, cv) != IAERROR_SUCCESS) || cv.IsEmpty()) cv = _T(" "); if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_IC1800) == 0) && (si == _T("Instrument/Detector/Temp"))) { if(sv == _T("0")) sv = _T("40℃"); else if(sv == _T("1")) sv = _T("50℃"); else if(sv == _T("2")) sv = _T("60℃"); else sv = _T("参数错误"); if(cv == _T("0")) cv = _T("40℃"); else if(cv == _T("1")) cv = _T("50℃"); else if(cv == _T("2")) cv = _T("60℃"); else cv = _T("参数错误"); } tr.Format(_T("<tr><td>%s</td><td>%s</td><td>%s</td></tr>"), name, sv, cv); msg += tr; } msg += _T("</table>"); switch(HTMLMessageBox(NULL, msg, _T("当前设置参数与样品中的仪器参数不一致"), _T("采用样品中的仪器参数;采用当前设置参数;取消"), _T(";"), ICON_QUESTION)) { case 0: // 采用样品中的仪器参数 if(adSample.GetValue_XMLString(XMLPATH_SAMPLE_PARAM_INSTRUMENT, xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY; if(pcInstru->Base_DownloadToDevice(xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY; break; case 1:break; default://取消或X return IAERROR_CG_SAMPLE_NOTREADY; } } } if(!bConnected) { //连接仪器 int nret = Sample_LinkToInstrument(pcSample, pcInstru, pcSample->GetInstrumentChannel()); RETURNifERROR(nret); CString t; t.Format(_T("Sample_Prepare: CBase_AnalysisTemplate::Sample_LinkToInstrument:%d.\r\n"), nret); g_TracePersistentlyWithTime(t); } //设定仪器参数 int nRet = IAERROR_SUCCESS; // CString cStrXMLParam; // // if(IAERROR_SUCCESS!=pcSample->m_data.GetValue_XMLString(_T("Sample\\Parameter\\Instrument"), cStrXMLParam)) // return IAERROR_XML_ITEMNOTFOUND;//没有找到相应的仪器参数 // // nRet = Instrument_SetParam(pcInstru, _T("Instrument"), cStrXMLParam); if(nRet==IAERROR_CG_INSTRUMENT_ERROR) { return IAERROR_CG_INSTRUMENT_ERROR; } else if(nRet==IAERROR_SUCCESS) { return IAERROR_SUCCESS; } else return nRet; return IAERROR_CG_SAMPLE_NOTREADY; }
void CWHTable::GetColumnStrings(CStringArray& csStrings, BOOL fKillUnsupportedTypes) { // Retrieve the strings in the current column. // Keep finding strings until an 'end choice' token is found. int nIndex = m_nIndex; int nTableItems = m_csaLine.GetUpperBound(); int nFound = 0; while (nIndex < nTableItems) { // Find the next non empty string in the column while (m_csaLine[nIndex].IsEmpty()) { IncrementRow(nIndex); if (nIndex > nTableItems) break; } // Add the non empty string to the array if (nIndex <= nTableItems) { // Add string BOOL f = AddFoundString(csStrings, nIndex); nFound++; // Check for an unsupported type if (fKillUnsupportedTypes && nFound > m_nTitleStrings) { int nLastIndex = csStrings.GetUpperBound(); CString cs = csStrings[nLastIndex]; // Search for a token int nBang = cs.Find(m_cListEnd); if (nBang != -1) { CString csProjType = cs.Right(cs.GetLength() - (nBang+1)); int nProjType = atoi((const char*)csProjType); // Take off the project type info cs = cs.Left(nBang); csStrings[nLastIndex] = cs; // See if the project type is supported CPmwApp* pApp = GET_PMWAPP(); CPmwDocTemplate* pTemplate = NULL; POSITION pos = pApp->GetFirstDocTemplatePosition(); while (pos != NULL) { CPmwDocTemplate* pThisTemplate = (CPmwDocTemplate*)pApp->GetNextDocTemplate(pos); if (pThisTemplate->ProjectType() == nProjType) { pTemplate = pThisTemplate; break; } } if (pTemplate == NULL) { // Take it off the list, and empty it csStrings.RemoveAt(nLastIndex); m_csaLine[nIndex].Empty(); // In theory, if this string was the last in the column, // we should put a m_cListEnd char in front of the next to // last string in the column because this one is now gone. // We don't really need to do this, however, because we're // tossing out project types which are in the first row. } } } IncrementRow(nIndex); if (f) break; } } }