// child_mfcView.cpp : implementation of the Cchild_mfcView class
//
#include "stdafx.h"
#include "child_mfc.h"
#include "child_mfcDoc.h"
#include "child_mfcView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Cchild_mfcView
IMPLEMENT_DYNCREATE(Cchild_mfcView, CView)
BEGIN_MESSAGE_MAP(Cchild_mfcView, CView)
// 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)
ON_WM_CREATE()
ON_COMMAND(ID_SHOW, OnShow)
ON_COMMAND(ID_SEND, OnSend)
END_MESSAGE_MAP()
// Cchild_mfcView construction/destruction
Cchild_mfcView::Cchild_mfcView()
: m_name(_T(""))
{
// TODO: add construction code here
}
Cchild_mfcView::~Cchild_mfcView()
{
}
BOOL Cchild_mfcView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
// Cchild_mfcView drawing
void Cchild_mfcView::OnDraw(CDC* /*pDC*/)
{
Cchild_mfcDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
// Cchild_mfcView printing
BOOL Cchild_mfcView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void Cchild_mfcView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void Cchild_mfcView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
// Cchild_mfcView diagnostics
#ifdef _DEBUG
void Cchild_mfcView::AssertValid() const
{
CView::AssertValid();
}
void Cchild_mfcView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
Cchild_mfcDoc* Cchild_mfcView::GetDocument() const // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cchild_mfcDoc)));
return (Cchild_mfcDoc*)m_pDocument;
}
#endif //_DEBUG
// Cchild_mfcView message handlers
int Cchild_mfcView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
m_name=AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor(NULL, IDC_CROSS),
(HBRUSH) ::GetStockObject(LTGRAY_BRUSH), ::LoadIcon(NULL, IDI_APPLICATION));
return 0;
}
void Cchild_mfcView::OnShow()
{
// TODO: Add your command handler code here
m_pchild = new Cchild;
m_pchild->Create(m_name, "Child Window", WS_CHILD | WS_VISIBLE | WS_THICKFRAME |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU,
CRect(10, 30, 300, 150), this, 1234);
}
void Cchild_mfcView::OnSend()
{
// TODO: Add your command handler code here
m_pchild->SetWindowText("Title changed");
}