////////////////////////////////////////////////////// // // // 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 // // // ////////////////////////////////////////////////////// // // Scenario1.cpp : implementation file // #include "stdafx.h" #include "Clock.h" #include "Scenario1.h" #include "MyFunc.h" #include "afxpriv.h" #include "afxext.h" #include "IncClockSynch.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // Scenario1 dialog Scenario1::Scenario1(CWnd* pParent /*=NULL*/) : CDialog(Scenario1::IDD, pParent) { //{{AFX_DATA_INIT(Scenario1) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void Scenario1::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(Scenario1) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(Scenario1, CDialog) //{{AFX_MSG_MAP(Scenario1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Scenario1 message handlers //DEL BOOL Scenario1::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) //DEL { //DEL // TODO: Add your specialized code here and/or call the base class //DEL //DEL return CDialog::Create(IDD, pParentWnd); //DEL } //DEL void Scenario1::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 Scenario1::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); MessageBox(" See you next time . "); exit(1); } void Scenario1::OnOK() { // TODO: Add extra validation here long ProcNum,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); char str1[80],str2[80],str3[80],str4[80],str5[80]; 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) && strlen(str5) )) MessageBox("You have to fill all data"); else { char str[1000]; str[0]='\0'; ProcNum=myAtoi(str1); if (ProcNum<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); StopTime = myAtoi(str5) ; if (StopTime<=0) strcat(str,TIMEstr); if (strlen(str)) MessageBox(str); else CDialog::OnOK(); mainPr(ProcNum,MinClock,MaxClock,PercentCorrectProc,StopTime); }} //DEL void Scenario1::OnHelp() //DEL { //DEL // TODO: Add your control notification handler code here //DEL //DEL } BOOL Scenario1::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CEdit *ebptr1 = (CEdit*) GetDlgItem(IDC_EDIT1); CEdit *ebptr5 = (CEdit*) GetDlgItem(IDC_EDIT5); ebptr1->SetWindowText("10"); ebptr5->SetWindowText("20"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }