|
#include "StdAfx.h"
#include "SerialTestMFC.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only CTestApp object
CTestApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CTestApp
BEGIN_MESSAGE_MAP(CTestApp, CWinApp)
//{{AFX_MSG_MAP(CTestApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_COM_OPEN, OnComOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestApp methods
CTestApp::CTestApp()
{
}
CTestApp::~CTestApp()
{
}
BOOL CTestApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
CMDIFrameWnd* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
// create main MDI frame window
if (!pFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
// try to load shared MDI menus and accelerator table
HINSTANCE hInst = AfxGetResourceHandle();
m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_SERIALTYPE));
m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_SERIALTYPE));
// The main window has been initialized, so show and update it.
pFrame->ShowWindow(m_nCmdShow);
pFrame->UpdateWindow();
return TRUE;
}
int CTestApp::ExitInstance()
{
if (m_hMDIMenu)
FreeResource(m_hMDIMenu);
if (m_hMDIAccel)
FreeResource(m_hMDIAccel);
return CWinApp::ExitInstance();
}
void CTestApp::OnComOpen()
{
CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame,m_pMainWnd);
// Create a new MDI child window
pFrame->CreateNewChild(RUNTIME_CLASS(CChildFrame), IDR_SERIALTYPE, m_hMDIMenu, m_hMDIAccel);
}
void CTestApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.