view src/win32/ModeConfirm.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // ModeConfirm.cpp : implementation file
2 //
4 #include "stdafx.h"
5 #include "resource.h"
6 #include "ModeConfirm.h"
7 #include "VBA.h"
9 /////////////////////////////////////////////////////////////////////////////
10 // ModeConfirm dialog
13 ModeConfirm::ModeConfirm(CWnd* pParent /*=NULL*/)
14 : CDialog(ModeConfirm::IDD, pParent)
15 {
16 //{{AFX_DATA_INIT(ModeConfirm)
17 // NOTE: the ClassWizard will add member initialization here
18 //}}AFX_DATA_INIT
19 }
22 void ModeConfirm::DoDataExchange(CDataExchange* pDX)
23 {
24 CDialog::DoDataExchange(pDX);
25 //{{AFX_DATA_MAP(ModeConfirm)
26 // NOTE: the ClassWizard will add DDX and DDV calls here
27 //}}AFX_DATA_MAP
28 }
31 BEGIN_MESSAGE_MAP(ModeConfirm, CDialog)
32 //{{AFX_MSG_MAP(ModeConfirm)
33 ON_BN_CLICKED(ID_CANCEL, OnCancel)
34 ON_BN_CLICKED(ID_OK, OnOk)
35 ON_WM_DESTROY()
36 ON_WM_TIMER()
37 //}}AFX_MSG_MAP
38 END_MESSAGE_MAP()
40 /////////////////////////////////////////////////////////////////////////////
41 // ModeConfirm message handlers
43 void ModeConfirm::OnCancel()
44 {
45 EndDialog(FALSE);
46 }
48 void ModeConfirm::OnOk()
49 {
50 EndDialog(TRUE);
51 }
53 void ModeConfirm::OnDestroy()
54 {
55 CDialog::OnDestroy();
57 KillTimer(timer);
58 timer = 0;
59 }
61 BOOL ModeConfirm::OnInitDialog()
62 {
63 CDialog::OnInitDialog();
65 timer = SetTimer(0, 1000, NULL);
67 count = 10;
69 CString buffer;
70 buffer.Format("%d", count);
72 GetDlgItem(IDC_TIMER)->SetWindowText(buffer);
74 CenterWindow(theApp.m_pMainWnd);
76 return TRUE; // return TRUE unless you set the focus to a control
77 // EXCEPTION: OCX Property Pages should return FALSE
78 }
80 void ModeConfirm::OnTimer(UINT nIDEvent)
81 {
82 CString buffer;
83 count--;
84 if(count == 0)
85 EndDialog(FALSE);
86 buffer.Format("%d", count);
87 GetDlgItem(IDC_TIMER)->SetWindowText(buffer);
89 CDialog::OnTimer(nIDEvent);
90 }