void CMSG_Server::AddMessage(char *strMessage, int size, int color) { CDialog *pDlg = (CDialog*)pMainDlg; ::PostMessageA(pDlg->GetSafeHwnd(),ID_MSG_STATE,0,(LPARAM)strMessage); }
void CMorphaResDlg::OnClickListMorphadata(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; LV_COLUMN lc; lc.mask = LVCF_TEXT ; TCHAR pszText[40]; lc.pszText = pszText; lc.cchTextMax = sizeof(pszText)/sizeof(pszText[0]); int nCol = 0; while (m_wndMorphaDataList.GetColumn(nCol,&lc)) { if(CString(lc.pszText) == TEXT("检测号")) break; ++nCol; } CString str=m_wndMorphaDataList.GetItemText(pNMListView->iItem,nCol); if(str == "") return; CString strSQLinfo("select distinct *,basicinfo.pdetectno as 'pDetectno' from basicinfo,spermchait\ where basicinfo.pdetectno=spermchait.pdetectno and \ basicinfo.pdetectno='"); strSQLinfo= strSQLinfo + str + CString("'"); CPropertySheet* pSheet=(CPropertySheet*)GetParent(); CStatic* pStatic=(CStatic*)pSheet->GetParent(); CMorphaDataRetriveDlg* pDlg=(CMorphaDataRetriveDlg*)pStatic->GetParent(); try { _variant_t var; COleDateTime pddt; _RecordsetPtr rs=theConnection->Execute((LPCTSTR)strSQLinfo,NULL,adCmdText); var = rs->GetCollect("pDetectno"); pDlg->m_strEditDetectNO = (char*)(_bstr_t)var; // pDlg->m_strEditDetectNO.TrimLeft(); // pDlg->m_strEditDetectNO.TrimRight(); var = rs->GetCollect("pCaseNO"); pDlg->m_strEditCaseNO = (char*)(_bstr_t)var; // pDlg->m_strEditCaseNO.TrimLeft(); // pDlg->m_strEditCaseNO.TrimRight(); var = rs->GetCollect("pname"); pDlg->m_strEditName = (char*)(_bstr_t)var; // pDlg->m_strEditName.TrimLeft(); // pDlg->m_strEditName.TrimRight(); var = rs->GetCollect("pspermvolume"); pDlg->m_strEditSpermVolume = (char*)(_bstr_t)var; // pDlg->m_strEditSpermVolume.TrimLeft(); // pDlg->m_strEditSpermVolume.TrimRight(); var = rs->GetCollect("page"); pDlg->m_strEditAge = (char*)(_bstr_t)var; // pDlg->m_strEditAge.TrimLeft(); // pDlg->m_strEditAge.TrimRight(); pddt=rs->GetCollect("pdetectdatetime"); pDlg->m_oledateDetectDate.SetDate(pddt.GetYear(),pddt.GetMonth(),pddt.GetDay()); pDlg->m_oletimeDetectTime.SetTime(pddt.GetHour(),pddt.GetMinute(),pddt.GetSecond()); var = rs->GetCollect("pSampleNO"); pDlg->m_strEditSampleNO = (char*)(_bstr_t)var; // pDlg->m_strEditSampleNO.TrimLeft(); // pDlg->m_strEditSampleNO.TrimRight(); var = rs->GetCollect("pdilutionratio"); pDlg->m_strEditDilutionRatio = (char*)(_bstr_t)var; // pDlg->m_strEditDilutionRatio.TrimLeft(); // pDlg->m_strEditDilutionRatio.TrimRight(); var = rs->GetCollect("pShape"); pDlg->m_strEditShape = (char*)(_bstr_t)var; // pDlg->m_strEditShape.TrimLeft(); // pDlg->m_strEditShape.TrimRight(); pddt=rs->GetCollect("pspermgetdatetime"); pDlg->m_oledateSpermGetDate.SetDate(pddt.GetYear(),pddt.GetMonth(),pddt.GetDay()); pDlg->m_oletimeSpermGetTime.SetTime(pddt.GetHour(),pddt.GetMinute(),pddt.GetSecond()); var = rs->GetCollect("pcolor"); pDlg->m_strEditSpermColor = (char*)(_bstr_t)var; // pDlg->m_strEditSpermColor.TrimLeft(); // pDlg->m_strEditSpermColor.TrimRight(); var = rs->GetCollect("pcohesion"); pDlg->m_strEditCohension = (char*)(_bstr_t)var; // pDlg->m_strEditCohension.TrimLeft(); // pDlg->m_strEditCohension.TrimRight(); var = rs->GetCollect("pRoomTempera"); pDlg->m_strEditRoomTempera = (char*)(_bstr_t)var; // pDlg->m_strEditRoomTempera.TrimLeft(); // pDlg->m_strEditRoomTempera.TrimRight(); var = rs->GetCollect("pdaysofabstinency"); pDlg->m_strEditAbstinency = (char*)(_bstr_t)var; // pDlg->m_strEditAbstinency.TrimLeft(); // pDlg->m_strEditAbstinency.TrimRight(); var = rs->GetCollect("pliquifystate"); pDlg->m_strEditLiquifyState = (char*)(_bstr_t)var; // pDlg->m_strEditLiquifyState.TrimLeft(); // pDlg->m_strEditLiquifyState.TrimRight(); var = rs->GetCollect("psmell"); pDlg->m_strEditSmell = (char*)(_bstr_t)var; // pDlg->m_strEditSmell.TrimLeft(); // pDlg->m_strEditSmell.TrimRight(); var = rs->GetCollect("pthickness"); pDlg->m_strEditThickness = (char*)(_bstr_t)var; // pDlg->m_strEditThickness.TrimLeft(); // pDlg->m_strEditThickness.TrimRight(); var = rs->GetCollect("pph"); pDlg->m_strEditPH = (char*)(_bstr_t)var; // pDlg->m_strEditPH.TrimLeft(); // pDlg->m_strEditPH.TrimRight(); var = rs->GetCollect("pspermmethod"); pDlg->m_strEditSpermWay = (char*)(_bstr_t)var; // pDlg->m_strEditSpermWay.TrimLeft(); // pDlg->m_strEditSpermWay.TrimRight(); var = rs->GetCollect("pliquifytime"); pDlg->m_strEditLiquifyTime = (char*)(_bstr_t)var; // pDlg->m_strEditLiquifyTime.TrimLeft(); // pDlg->m_strEditLiquifyTime.TrimRight(); pDlg->UpdateData(FALSE); } catch (_com_error& e) { AfxMessageBox(e.Description()); return; } // str.Format("select * from morphasperminfo where pid like('%s%%')", pDlg->m_strEditDetectNO); try { _RecordsetPtr rs=theConnection->Execute((LPCTSTR)str,NULL,adCmdText); _variant_t vt; SingleSpermInfo ssInfo; pDlg->m_vSpermInfo.clear(); while(!rs->EndOfFile) { vt = rs->GetCollect("x"); ssInfo.pos.x = (long)vt; vt = rs->GetCollect("y"); ssInfo.pos.y = (long)vt; vt = rs->GetCollect("pid"); CString cs; cs = (char*)(_bstr_t)vt; int nl = cs.ReverseFind('_'); nl = cs.GetLength()-nl-1; cs = cs.Right(nl); ssInfo.nSpermNO = atol((LPCTSTR)cs); vt = rs->GetCollect("IsNormal"); ssInfo.bIsNormal = (bool)vt; vt = rs->GetCollect("m_length"); ssInfo.smPara.m_length = (double)vt; vt = rs->GetCollect("m_width"); ssInfo.smPara.m_width = (double)vt; vt = rs->GetCollect("m_area"); ssInfo.smPara.m_area = (double)vt; vt = rs->GetCollect("m_ellipticity"); ssInfo.smPara.m_ellipticity = (double)vt; vt = rs->GetCollect("m_perfor_area"); ssInfo.smPara.m_perfor_area = (double)vt; vt = rs->GetCollect("m_head_area"); ssInfo.smPara.m_head_area = (double)vt; vt = rs->GetCollect("m_perimeter"); ssInfo.smPara.m_perimeter = (double)vt; vt = rs->GetCollect("m_head_perfor_area"); ssInfo.smPara.m_head_perfor_area = (double)vt; vt = rs->GetCollect("m_tail_length"); ssInfo.smPara.m_tail_length = (double)vt; vt = rs->GetCollect("m_tail_width"); ssInfo.smPara.m_tail_width = (double)vt; vt = rs->GetCollect("m_tail_angle"); ssInfo.smPara.m_tail_angle = (double)vt; vt = rs->GetCollect("m_extension"); ssInfo.smPara.m_extension = (double)vt; vt = rs->GetCollect("m_symmetry"); ssInfo.smPara.m_symmetry = (double)vt; vt = rs->GetCollect("m_ruga"); ssInfo.smPara.m_ruga = (double)vt; pDlg->m_vSpermInfo.push_back(ssInfo); rs->MoveNext(); } // Update UI button UINT uSelectedCount = m_wndMorphaDataList.GetSelectedCount(); BOOL enable = uSelectedCount>=1 ? TRUE : FALSE; CDialog *pdlg = ((CMainFrame*)AfxGetMainWnd())->m_pWndMorphadlg; ::SendMessage(pdlg->GetSafeHwnd(), USER_MSG_SHOW_PRINT_BTN, (WPARAM)enable, 0); ::SendMessage(pdlg->GetSafeHwnd(), USER_MSG_SHOW_MOPHY_DEL_SEL_BTN, (WPARAM)enable, 0); } catch (_com_error& e) { MessageBox(e.Description()); return; } *pResult = 0; }