////////////////////////////////////////////////////// // // // Incremental Clock Syncronization. // // 236503(20) Summer 2001 // // Advanced Programming Project. // // Technion. Computer Science Department. // // // // Written by: Reitman Anna // // Fidelman Greg // // Supervisor: Hagit Attya // // Saar Pilosof // // // ////////////////////////////////////////////////////// // // Scenario2.cpp : implementation file // #include "stdafx.h" #include "Clock.h" #include "Scenario2.h" #include "MyFunc.h" #include "IncClockSynch.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // Scenario2 dialog Scenario2::Scenario2(CWnd* pParent /*=NULL*/) : CDialog(Scenario2::IDD, pParent) { //{{AFX_DATA_INIT(Scenario2) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void Scenario2::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(Scenario2) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(Scenario2, CDialog) //{{AFX_MSG_MAP(Scenario2) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Scenario2 message handlers //DEL void Scenario2::WinHelp(DWORD dwData, UINT nCmd) //DEL { //DEL // TODO: Add your specialized code here and/or call the base class //DEL //DEL CDialog::WinHelp(dwData, nCmd); //DEL } void Scenario2::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); MessageBox(" See you next time. "); exit(1); } void Scenario2::OnOK() { // TODO: Add extra validation here long MaxProcNum,StopGap,MinClock,MaxClock,PercentCorrectProc,StopTime; CEdit *ebptr1 = (CEdit*) GetDlgItem(IDC_EDIT1); CEdit *ebptr2= (CEdit*) GetDlgItem(IDC_EDIT2); CEdit *ebptr3 = (CEdit*) GetDlgItem(IDC_EDIT3); CEdit *ebptr4 = (CEdit*) GetDlgItem(IDC_EDIT4); CEdit *ebptr5 = (CEdit*) GetDlgItem(IDC_EDIT5); CEdit *ebptr6 = (CEdit*) GetDlgItem(IDC_EDIT6); char str1[10],str2[10],str3[10],str4[10],str5[10],str6[10]; ebptr1->GetWindowText(str1,sizeof str1 -1 ); ebptr2->GetWindowText(str2,sizeof str2 -1); ebptr3->GetWindowText(str3,sizeof str3 -1); ebptr4->GetWindowText(str4,sizeof str4 -1); ebptr5->GetWindowText(str5,sizeof str5 -1); ebptr6->GetWindowText(str6,sizeof str6 -1); if (!(strlen(str1) && strlen(str2) && strlen(str3) && strlen(str4) && strlen(str5) && strlen(str6))) MessageBox("You have to fill all data"); else { char str[1000]; str[0]='\0'; MaxProcNum=myAtoi(str1); if (MaxProcNum<2) strcat(str,TOTALstr); MinClock=myAtoi(str2); if (MinClock<0 ) strcat(str,MINstr); MaxClock=myAtoi(str3); if (MaxClock<=MinClock) strcat(str,MAXstr); PercentCorrectProc=myAtoi(str4); if (PercentCorrectProc<0) strcat(str,PERCENTstr); StopGap=myAtoi(str5); if (StopGap<0) strcat(str,GAPstr); StopTime=myAtoi(str6); if (StopTime<=0) strcat(str,TIMEstr); if (strlen(str)) MessageBox(str); else { CDialog::OnOK(); mainPr(MaxProcNum,StopGap,MinClock,MaxClock,PercentCorrectProc,StopTime); }} } //DEL BOOL Scenario2::OnHelpInfo(HELPINFO* pHelpInfo) //DEL { //DEL // TODO: Add your message handler code here and/or call default //DEL //DEL return CDialog::OnHelpInfo(pHelpInfo); //DEL } BOOL Scenario2::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CEdit *ebptr6 = (CEdit*) GetDlgItem(IDC_EDIT6); ebptr6->SetWindowText("20"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }