1
// HostApp.cpp : Defines the class behaviors for the application.
8
#include "HostAppDoc.h"
9
#include "HostAppView.h"
11
// CppUnit: MFC TestRunner
12
#include <cppunit/ui/mfc/TestRunner.h>
13
// CppUnit: TestFactoryRegistry to retreive the top test suite that contains all registered tests.
14
#include <cppunit/extensions/TestFactoryRegistry.h>
19
static char THIS_FILE[] = __FILE__;
22
static AFX_EXTENSION_MODULE extTestRunner;
24
/////////////////////////////////////////////////////////////////////////////
27
BEGIN_MESSAGE_MAP(CHostAppApp, CWinApp)
28
//{{AFX_MSG_MAP(CHostAppApp)
29
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
30
// NOTE - the ClassWizard will add and remove mapping macros here.
31
// DO NOT EDIT what you see in these blocks of generated code!
33
// Standard file based document commands
34
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
35
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
36
// Standard print setup command
37
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
40
/////////////////////////////////////////////////////////////////////////////
41
// CHostAppApp construction
43
CHostAppApp::CHostAppApp()
45
// TODO: add construction code here,
46
// Place all significant initialization in InitInstance
49
/////////////////////////////////////////////////////////////////////////////
50
// The one and only CHostAppApp object
54
/////////////////////////////////////////////////////////////////////////////
55
// CHostAppApp initialization
57
BOOL CHostAppApp::InitInstance()
59
// Standard initialization
60
// If you are not using these features and wish to reduce the size
61
// of your final executable, you should remove from the following
62
// the specific initialization routines you do not need.
65
# if _MSC_VER < 1300 // vc6
66
Enable3dControls(); // Call this when using MFC in a shared DLL
69
Enable3dControlsStatic(); // Call this when linking to MFC statically
72
// Change the registry key under which our settings are stored.
73
// You should modify this string to be something appropriate
74
// such as the name of your company or organization.
75
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
77
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
79
// Register the application's document templates. Document templates
80
// serve as the connection between documents, frame windows and views.
82
CSingleDocTemplate* pDocTemplate;
83
pDocTemplate = new CSingleDocTemplate(
85
RUNTIME_CLASS(CHostAppDoc),
86
RUNTIME_CLASS(CMainFrame), // main SDI frame window
87
RUNTIME_CLASS(CHostAppView));
88
AddDocTemplate(pDocTemplate);
93
// Parse command line for standard shell commands, DDE, file open
94
CCommandLineInfo cmdInfo;
95
ParseCommandLine(cmdInfo);
97
// Dispatch commands specified on the command line
98
if (!ProcessShellCommand(cmdInfo))
101
// The one and only window has been initialized, so show and update it.
102
m_pMainWnd->ShowWindow(SW_SHOW);
103
m_pMainWnd->UpdateWindow();
111
CHostAppApp::RunUnitTests()
113
CPPUNIT_NS::MfcUi::TestRunner runner;
114
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
120
/////////////////////////////////////////////////////////////////////////////
121
// CAboutDlg dialog used for App About
123
class CAboutDlg : public CDialog
129
//{{AFX_DATA(CAboutDlg)
130
enum { IDD = IDD_ABOUTBOX };
133
// ClassWizard generated virtual function overrides
134
//{{AFX_VIRTUAL(CAboutDlg)
136
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
141
//{{AFX_MSG(CAboutDlg)
142
// No message handlers
144
DECLARE_MESSAGE_MAP()
147
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
149
//{{AFX_DATA_INIT(CAboutDlg)
153
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
155
CDialog::DoDataExchange(pDX);
156
//{{AFX_DATA_MAP(CAboutDlg)
160
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
161
//{{AFX_MSG_MAP(CAboutDlg)
162
// No message handlers
166
// App command to run the dialog
167
void CHostAppApp::OnAppAbout()
173
/////////////////////////////////////////////////////////////////////////////
174
// CHostAppApp commands