messageboxview.cpp

来自「本压缩软件为《Visual C++6.0基础教程》(黑魔方系列)一书的源代码」· C++ 代码 · 共 110 行

CPP
110
字号
// MessageBoxView.cpp : implementation of the CMessageBoxView class
//

#include "stdafx.h"
#include "MessageBox.h"

#include "MessageBoxDoc.h"
#include "MessageBoxView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMessageBoxView

IMPLEMENT_DYNCREATE(CMessageBoxView, CView)

BEGIN_MESSAGE_MAP(CMessageBoxView, CView)
	//{{AFX_MSG_MAP(CMessageBoxView)
	ON_COMMAND(IDC_SHOW, OnShow)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMessageBoxView construction/destruction

CMessageBoxView::CMessageBoxView()
{
	// TODO: add construction code here

}

CMessageBoxView::~CMessageBoxView()
{
}

BOOL CMessageBoxView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMessageBoxView drawing

void CMessageBoxView::OnDraw(CDC* pDC)
{
	CMessageBoxDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CMessageBoxView printing

BOOL CMessageBoxView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMessageBoxView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMessageBoxView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMessageBoxView diagnostics

#ifdef _DEBUG
void CMessageBoxView::AssertValid() const
{
	CView::AssertValid();
}

void CMessageBoxView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMessageBoxDoc* CMessageBoxView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMessageBoxDoc)));
	return (CMessageBoxDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMessageBoxView message handlers

void CMessageBoxView::OnShow() 
{
	// TODO: Add your command handler code here
	MessageBox("确定要退出吗?","消息框",MB_YESNOCANCEL|MB_ICONSTOP);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?