Source code of Windows XP (NT5)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// mditest.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "mditest.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__; #endif
/////////////////////////////////////////////////////////////////////////////
// CMditestApp
BEGIN_MESSAGE_MAP(CMditestApp, CWinApp) //{{AFX_MSG_MAP(CMditestApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout) ON_COMMAND(ID_FILE_NEW, OnFileNew) //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMditestApp construction
CMditestApp::CMditestApp() { }
/////////////////////////////////////////////////////////////////////////////
// The one and only CMditestApp object
CMditestApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMditestApp initialization
BOOL CMditestApp::InitInstance() { // Standard initialization
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
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_MDITESTYPE)); m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_MDITESTYPE));
pFrame->ShowWindow(m_nCmdShow); pFrame->UpdateWindow();
return TRUE; }
/////////////////////////////////////////////////////////////////////////////
// CMditestApp message handlers
int CMditestApp::ExitInstance() { if (m_hMDIMenu != NULL) FreeResource(m_hMDIMenu); if (m_hMDIAccel != NULL) FreeResource(m_hMDIAccel);
return CWinApp::ExitInstance(); }
void CMditestApp::OnFileNew() { CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
// create a new MDI child window
pFrame->CreateNewChild( RUNTIME_CLASS(CChildFrame), IDR_MDITESTYPE, m_hMDIMenu, m_hMDIAccel); }
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog { public: CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected: //{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP() };
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CMditestApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); }
/////////////////////////////////////////////////////////////////////////////
// CMditestApp message handlers
|