////////////////////////////////////////////////////// // // // 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 // // // ////////////////////////////////////////////////////// // // Scenario3.cpp : implementation file // #include "stdafx.h" #include "Clock.h" #include "Scenario3.h" #include "MyFunc.h" #include "IncClockSynch.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // Scenario3 dialog Scenario3::Scenario3(CWnd* pParent /*=NULL*/) : CDialog(Scenario3::IDD, pParent) { //{{AFX_DATA_INIT(Scenario3) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void Scenario3::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(Scenario3) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(Scenario3, CDialog) //{{AFX_MSG_MAP(Scenario3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Scenario3 message handlers //DEL void Scenario3::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 Scenario3::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); MessageBox(" See you next time. "); exit(1); } void Scenario3::OnOK() { // TODO: Add extra validation here long ClocksValue ,MaxProcNum, NewClockValue,StopGap,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); char str1[10],str2[10],str3[10],str4[10],str5[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); if (!(strlen(str1) && strlen(str2) && strlen(str3) && strlen(str4))) MessageBox("You have to fill all data"); else { char str[1000]; str[0]='\0'; MaxProcNum=myAtoi(str1); if (MaxProcNum<2) strcat(str,TOTALstr); ClocksValue=myAtoi(str2); if (ClocksValue<0 ) strcat(str,MINstr); NewClockValue=myAtoi(str3); if (NewClockValue<0) strcat(str,NEWstr); StopGap=myAtoi(str4); if (StopGap<0) strcat(str,GAPstr); StopTime=myAtoi(str5); if (StopTime<=0) strcat(str,TIMEstr); if (strlen(str)) MessageBox(str); else{ CDialog::OnOK(); mainPt(ClocksValue,MaxProcNum,NewClockValue,StopGap,StopTime); }} } BOOL Scenario3::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CEdit *ebptr3 = (CEdit*) GetDlgItem(IDC_EDIT3); ebptr3->SetWindowText("0"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }