Modeless Dialog and Controls
Modeless Dialog and Controls
#include "stdafx.h"
#include "modles.h"
#include "di.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Cdi dialog
BEGIN_MESSAGE_MAP(Cdi, CDialog)
//{{AFX_MSG_MAP(Cdi)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void Cdi::OnButton1()
{
UpdateData(true);
CDC* pDC=GetDC();
pDC->TextOut(10,10,m_edit1);
ReleaseDC(pDC);
}
#include "stdafx.h"
#include "modles.h"
#include "di.h"
#include "modlesDoc.h"
#include "modlesView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// CModlesView
IMPLEMENT_DYNCREATE(CModlesView, CView)
BEGIN_MESSAGE_MAP(CModlesView, CView)
//{{AFX_MSG_MAP(CModlesView)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
//}}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()
// CModlesView construction/destruction
CModlesView::CModlesView()
{
m_pdlg=new Cdi(this);
}
CModlesView::~CModlesView()
{
delete m_pdlg;
}
// CModlesView drawing
// CModlesView printing
// CModlesView diagnostics
#ifdef _DEBUG
void CModlesView::AssertValid() const
{
CView::AssertValid();
}
#if !
defined(AFX_MODLESVIEW_H__E29AFA05_3905_4883_A5F4_3840B06
ACA5E__INCLUDED_)
#define
AFX_MODLESVIEW_H__E29AFA05_3905_4883_A5F4_3840B06ACA5E_
_INCLUDED_
#include "di.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Attributes
public:
CModlesDoc* GetDocument();
Cdi* m_pdlg;
// Operations
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CModlesView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
#endif // !
defined(AFX_MODLESVIEW_H__E29AFA05_3905_4883_A5F4_3840B06
ACA5E__INCLUDED_)
OUTPUT