Ejemplo n.º 1
0
BOOL CRITempDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CSetting<PROBECFG> prb;	
	CSetting<FILTERCFG> flt;
	CSetting<SYSTEMCFG> sys;
	prb.InstallFromFile(PRB_DEFINFO);
	flt.InstallFromFile(FLT_DEFINFO);
	sys.InstallFromFile(SYS_DEFINFO);

	AddCBItem(IDC_PROBE_ID,prb.GetTitleList('|'));	
	AddCBItem(IDC_SYSTEM_ID,sys.GetTitleList('|'));	
	AddCBItem(IDC_FILTER_ID,flt.GetTitleList('|'));	
	UpdateData();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 2
0
void CHello2Dlg::OnProcessSel(int id)
{
	int curch = m_chlist.GetCurSel();

	if(m_cmdbase == ID_32773) //data operation
	{
		CList<double,double> *data = &m_ridlgs[curch]->m_data;
		if(m_ridlgs[curch]->show_type == SHOW_ORGDATA)
			data = &m_ridlgs[curch]->m_output;

		if(id == 1) //show converted result
		{
			m_ridlgs[curch]->show_type = SHOW_MAINDATA;
			
		}
		if(id == 2) //show raw result
		{
			m_ridlgs[curch]->show_type = SHOW_ORGDATA;
		}
		
		if(id == 3)	//delete the current record
		{
			int pos = m_history.GetCurSel();
			if((pos >= 0) && (data))
			{
				POSITION p = data->GetHeadPosition();
				while(pos-- > 0 )
					data->GetNext(p);
				data->RemoveAt(p);
			}
		}
		if(id == 4)	//delete all the record
		{
			data->RemoveAll();
		}
		if(id == 5)	//export all the record
		{
			CFile cf;
		
			if(!cf.Open(DATAOUT_NAME,CFile::modeCreate|CFile::modeWrite))
				return;

			//write to txt and open with notepad
			if(data && (data->GetCount() > 0))
			{
				POSITION pos = data->GetHeadPosition();
				char r[50];
				do{
					double v =  data->GetAt(pos);
					
					sprintf(r,"%8f\r\n",v);
					cf.Write(r,strlen(r));
					if(pos == data->GetTailPosition())
						break;
					data->GetNext(pos);
				}while(1);
			}
			cf.Close();
			SHELLEXECUTEINFO   execInf;  
			ZeroMemory   (&execInf,   sizeof   (execInf));    
			execInf.cbSize   =   sizeof   (SHELLEXECUTEINFO);    
			execInf.fMask   =   SEE_MASK_NOCLOSEPROCESS;
			execInf.nShow = SW_SHOWNORMAL;
			execInf.lpFile   =   _T("\\windows\\pword.exe");    
			execInf.lpVerb   =   _T("open");  
			execInf.lpParameters = DATAOUT_NAME;
			ShellExecuteEx (&execInf);   
		}

	}
	if(m_cmdbase == ID_32772)
	{
		if(id == 1)
		{
			m_ridlgs[curview]->sidedata = NULL;
		}else{
			m_ridlgs[curview]->sidedata = &m_ridlgs[id-2]->m_data;
			m_ridlgs[curview]->side_ch = id-2;
		}
		m_ridlgs[curview]->SaveLastConfig();
	}
	if(m_cmdbase == ID_32771) //channel config
	{
		if(m_cfgtype == CFGTYPE_BORE)
		{
			CSetting<PROBECFG> prbset;
			prbset.InstallFromFile(PRB_DEFINFO);			
		
			if(id == 1)//just close it
			{
				m_ridlgs[curch]->cfg_now = CFGTYPE_NONE;
				for(int i=0;i<sizeof(m_ridlgs)/sizeof(CRunitemDialog*);i++){
					if((m_ridlgs[i]->cfg_now == CFGTYPE_BORE) && (i != curch) && (m_ridlgs[i]->side_ch == curch))
					{
						m_ridlgs[i]->sidedata = NULL;
					}
				}
			}else{
				m_ridlgs[curch]->m_prbid = prbset.GetNameAt(id-2);
				m_ridlgs[curch]->cfg_now = CFGTYPE_BORE;
			}
			m_ridlgs[curch]->SaveLastConfig();
		}
		if(m_cfgtype == CFGTYPE_THMO)
		{
			if(m_ridlgs[curch]->IsValid() && (id == 1)) //just close it
			{
				m_ridlgs[curch]->cfg_now = CFGTYPE_NONE;
				for(int i=0;i<sizeof(m_ridlgs)/sizeof(CRunitemDialog*);i++){
					if((m_ridlgs[i]->cfg_now == CFGTYPE_THMO) && (i != curch) && (m_ridlgs[i]->side_ch == curch))
					{
						m_ridlgs[i]->sidedata = NULL;
					}
				}
			}else{
				if(id != 1){
					m_ridlgs[curch]->cfg_now = CFGTYPE_THMO;
					CString types(_T("TBEJKNRS"));
					m_ridlgs[curch]->m_prbid = types.GetAt(id-2);
				}
			}
			m_ridlgs[curch]->SaveLastConfig();
		}
	}
	LoadCurrentView();
}
Ejemplo n.º 3
0
void CHello2Dlg::OnLbnDblclkList3()
{
	// TODO: 在此添加控件通知处理程序代码
  CMenu   mainmenu;    
  mainmenu.LoadMenu(IDR_SELPROBE);

  CMenu *pM = mainmenu.GetSubMenu(0);
  //remove the existing menu
  CString   str   ;  
  
  for(int   i=pM->GetMenuItemCount()-1;i>=0;i--)   //取得菜单的项数。  
  {    
          pM->GetMenuString(i,str,MF_BYPOSITION);    
          //将指定菜单项的标签拷贝到指定的缓冲区。MF_BYPOSITION的解释见上。    
		  pM->DeleteMenu(i,MF_BYPOSITION);   
  }
  
  CSetting<PROBECFG> prbset;
  prbset.InstallFromFile(PRB_DEFINFO);			
  CString namelist = prbset.GetTitleList('|');	

  int curch = m_chlist.GetCurSel();
  if(curch < 0)
	  return;

  if(m_cfgtype == CFGTYPE_BORE)
  {
	int j = 1;
	pM->AppendMenu(MF_STRING,ID_32771,_T("关闭"));

	while(namelist.Find('|',0) >= 0){
		CString item = namelist.Left(namelist.Find('|',0));
		pM->AppendMenu(MF_STRING,ID_32771+j,item);   //添加新的菜单项		
		namelist.Delete(0,item.GetLength() + 1);
		j = j+1;
	}
	m_cmdbase = ID_32771;
  }
  if(m_cfgtype == CFGTYPE_THMO)
  {
	  //TBEJKNRS
	  m_cmdbase = ID_32771;;
	  pM->AppendMenu(MF_STRING,ID_32771,_T("关闭"));
	  pM->AppendMenu(MF_STRING,ID_32772,_T("T型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32773,_T("B型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32774,_T("E型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32775,_T("J型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32776,_T("K型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32777,_T("N型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32778,_T("R型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32779,_T("S型热电偶"));
  }
  CRect rect;
  m_chlist.GetClientRect(&rect);
  
  CPoint pt;
  GetCursorPos(&pt);
  SetForegroundWindow();
  pM->TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,this);
  return;

}