1 // **************************************************************************************
2 // File: LeashMessageBox.cpp
3 // By: Arthur David Leather
4 // Created: 12/02/98
5 // Copyright @1998 Massachusetts Institute of Technology - All rights reserved.
6 // Description: CPP file for LeashMessageBox.h. Contains variables and functions
7 // for the Leash Special Message Dialog Box
8 //
9 // History:
10 //
11 // MM/DD/YY Inits Description of Change
12 // 12/02/98 ADL Original
13 // **************************************************************************************
14
15
16
17 #include "stdafx.h"
18 #include "leash.h"
19 #include "LeashMessageBox.h"
20
21 #ifdef _DEBUG
22 #define new DEBUG_NEW
23 #undef THIS_FILE
24 static char THIS_FILE[] = __FILE__;
25 #endif
26
27 DWORD CLeashMessageBox ::m_dwTime;
28
29 /////////////////////////////////////////////////////////////////////////////
30 // CLeashMessageBox dialog
31
CLeashMessageBox(CWnd * pParent,const CString msgText,DWORD dwTime)32 CLeashMessageBox::CLeashMessageBox(CWnd* pParent, const CString msgText, DWORD dwTime)
33 : CDialog(CLeashMessageBox::IDD, pParent)
34 {
35 m_dwTime = dwTime;
36
37 //{{AFX_DATA_INIT(CLeashMessageBox)
38 m_messageText = _T(msgText);
39 //}}AFX_DATA_INIT
40 }
41
~CLeashMessageBox()42 CLeashMessageBox::~CLeashMessageBox()
43 {
44 }
45
DoDataExchange(CDataExchange * pDX)46 void CLeashMessageBox::DoDataExchange(CDataExchange* pDX)
47 {
48 CDialog::DoDataExchange(pDX);
49 //{{AFX_DATA_MAP(CLeashMessageBox)
50 DDX_Text(pDX, IDC_LEASH_WARNING_MSG, m_messageText);
51 //}}AFX_DATA_MAP
52 }
53
54
BEGIN_MESSAGE_MAP(CLeashMessageBox,CDialog)55 BEGIN_MESSAGE_MAP(CLeashMessageBox, CDialog)
56 //{{AFX_MSG_MAP(CLeashMessageBox)
57 ON_WM_DESTROY()
58 //}}AFX_MSG_MAP
59 END_MESSAGE_MAP()
60
61 /////////////////////////////////////////////////////////////////////////////
62 // CLeashMessageBox message handlers
63
64 void CALLBACK CLeashMessageBox::MessageBoxTimer(HWND hwnd, UINT uiMsg, UINT_PTR idEvent, DWORD dwTime)
65 {
66 ::KillTimer(hwnd, 2);
67 ::SendMessage(hwnd, WM_CLOSE, 0, 0);
68 }
69
OnOK()70 void CLeashMessageBox::OnOK()
71 {
72 KillTimer(2);
73 SendMessage(WM_CLOSE, 0, 0);
74 }
75
OnInitDialog()76 BOOL CLeashMessageBox::OnInitDialog()
77 {
78 CDialog::OnInitDialog();
79 UINT_PTR idTimer = SetTimer(2, m_dwTime, &MessageBoxTimer);
80
81 return TRUE; // return TRUE unless you set the focus to a control
82 // EXCEPTION: OCX Property Pages should return FALSE
83 }
84