自己新建CDisplayView.h和CDisplayView.cpp文件,然后把下面的代码贴过去就行了。
需要自己新建资源Dialog,把Dialog的属性ID改成IDD_DISPLAYVIEW,就可以了。
CDisplayView.h
#pragma once #include <afxext.h> #include "resource.h" class CDisplayView : public CFormView { DECLARE_DYNCREATE(CDisplayView) protected: CDisplayView(); public: virtual ~CDisplayView(); enum { IDD = IDD_DISPLAYVIEW };//IDD_DISPLAYVIEW模态窗口的ID #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); protected: DECLARE_MESSAGE_MAP() };
CDisplayView.cpp
#include "stdafx.h" #include "CDisplayView.h" // CDisplayView IMPLEMENT_DYNCREATE(CDisplayView, CFormView) //IDD_DISPLAYVIEW模态框的ID CDisplayView::CDisplayView(): CFormView(IDD_DISPLAYVIEW){ } CDisplayView::~CDisplayView() { } BEGIN_MESSAGE_MAP(CDisplayView, CFormView) END_MESSAGE_MAP() #ifdef _DEBUG void CDisplayView::AssertValid() const { CFormView::AssertValid(); } #ifndef _WIN32_WCE void CDisplayView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif #endif //_DEBUG void CDisplayView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); // DDX_Text(pDX, IDC_EDIT2, sdf); }