1 // CppUnitTestAppDlg.cpp : implementation file
\r
5 #include "CppUnitTestApp.h"
\r
6 #include "CppUnitTestAppDlg.h"
\r
9 #define new DEBUG_NEW
\r
11 static char THIS_FILE[] = __FILE__;
\r
14 /////////////////////////////////////////////////////////////////////////////
\r
15 // CAboutDlg dialog used for App About
\r
17 class CAboutDlg : public CDialog
\r
23 //{{AFX_DATA(CAboutDlg)
\r
24 enum { IDD = IDD_ABOUTBOX };
\r
27 // ClassWizard generated virtual function overrides
\r
28 //{{AFX_VIRTUAL(CAboutDlg)
\r
30 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
\r
35 //{{AFX_MSG(CAboutDlg)
\r
37 DECLARE_MESSAGE_MAP()
\r
40 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
\r
42 //{{AFX_DATA_INIT(CAboutDlg)
\r
46 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
\r
48 CDialog::DoDataExchange(pDX);
\r
49 //{{AFX_DATA_MAP(CAboutDlg)
\r
53 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
\r
54 //{{AFX_MSG_MAP(CAboutDlg)
\r
55 // No message handlers
\r
59 /////////////////////////////////////////////////////////////////////////////
\r
60 // CppUnitTestAppDlg dialog
\r
62 CppUnitTestAppDlg::CppUnitTestAppDlg(CWnd* pParent /*=NULL*/)
\r
63 : CDialog(CppUnitTestAppDlg::IDD, pParent)
\r
65 //{{AFX_DATA_INIT(CppUnitTestAppDlg)
\r
66 // NOTE: the ClassWizard will add member initialization here
\r
68 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
\r
69 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
\r
72 void CppUnitTestAppDlg::DoDataExchange(CDataExchange* pDX)
\r
74 CDialog::DoDataExchange(pDX);
\r
75 //{{AFX_DATA_MAP(CppUnitTestAppDlg)
\r
76 // NOTE: the ClassWizard will add DDX and DDV calls here
\r
80 BEGIN_MESSAGE_MAP(CppUnitTestAppDlg, CDialog)
\r
81 //{{AFX_MSG_MAP(CppUnitTestAppDlg)
\r
84 ON_WM_QUERYDRAGICON()
\r
88 /////////////////////////////////////////////////////////////////////////////
\r
89 // CppUnitTestAppDlg message handlers
\r
91 BOOL CppUnitTestAppDlg::OnInitDialog()
\r
93 CDialog::OnInitDialog();
\r
95 // Add "About..." menu item to system menu.
\r
97 // IDM_ABOUTBOX must be in the system command range.
\r
98 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
\r
99 ASSERT(IDM_ABOUTBOX < 0xF000);
\r
101 CMenu* pSysMenu = GetSystemMenu(FALSE);
\r
102 if (pSysMenu != NULL)
\r
104 CString strAboutMenu;
\r
105 strAboutMenu.LoadString(IDS_ABOUTBOX);
\r
106 if (!strAboutMenu.IsEmpty())
\r
108 pSysMenu->AppendMenu(MF_SEPARATOR);
\r
109 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
\r
113 // Set the icon for this dialog. The framework does this automatically
\r
114 // when the application's main window is not a dialog
\r
115 SetIcon(m_hIcon, TRUE); // Set big icon
\r
116 SetIcon(m_hIcon, FALSE); // Set small icon
\r
118 // TODO: Add extra initialization here
\r
120 return TRUE; // return TRUE unless you set the focus to a control
\r
123 void CppUnitTestAppDlg::OnSysCommand(UINT nID, LPARAM lParam)
\r
125 if ((nID & 0xFFF0) == IDM_ABOUTBOX)
\r
127 CAboutDlg dlgAbout;
\r
128 dlgAbout.DoModal();
\r
132 CDialog::OnSysCommand(nID, lParam);
\r
136 // If you add a minimize button to your dialog, you will need the code below
\r
137 // to draw the icon. For MFC applications using the document/view model,
\r
138 // this is automatically done for you by the framework.
\r
140 void CppUnitTestAppDlg::OnPaint()
\r
144 CPaintDC dc(this); // device context for painting
\r
146 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
\r
148 // Center icon in client rectangle
\r
149 int cxIcon = GetSystemMetrics(SM_CXICON);
\r
150 int cyIcon = GetSystemMetrics(SM_CYICON);
\r
152 GetClientRect(&rect);
\r
153 int x = (rect.Width() - cxIcon + 1) / 2;
\r
154 int y = (rect.Height() - cyIcon + 1) / 2;
\r
157 dc.DrawIcon(x, y, m_hIcon);
\r
161 CDialog::OnPaint();
\r
165 // The system calls this to obtain the cursor to display while the user drags
\r
166 // the minimized window.
\r
167 HCURSOR CppUnitTestAppDlg::OnQueryDragIcon()
\r
169 return (HCURSOR) m_hIcon;
\r