收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 属性表单问题,编译后,运行中会出错,求教!

共9个头文件,7个源文件

 

// MainFrm.h : CMainFrame 类的接口

#pragma once
class CMainFrame : public CFrameWnd

protected: // 仅从序列化创建
 CMainFrame();
 DECLARE_DYNCREATE(CMainFrame)
// 属性
public:
// 操作
public:
// 重写
public:
 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 实现
public:
 virtual ~CMainFrame();
#ifdef _DEBUG
 virtual void AssertValid() const;
 virtual void Dump(CDumpContext& dc) const;
#endif
protected:  // 控件条嵌入成员
 CStatusBar  m_wndStatusBar;
 CToolBar    m_wndToolBar;
// 生成的消息映射函数
protected:
 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 DECLARE_MESSAGE_MAP()
};

 

// Prop.h : Prop 应用程序的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
 #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
#endif
#include "resource.h"       // 主符号
// CPropApp:
// 有关此类的实现,请参阅 Prop.cpp

class CPropApp : public CWinApp
{
public:
 CPropApp();
// 重写
public:
 virtual BOOL InitInstance();
// 实现
 afx_msg void OnAppAbout();
 DECLARE_MESSAGE_MAP()
};
extern CPropApp theApp;

 

//Prop1.h
#pragma once
// CProp1 对话框
class CProp1 : public CPropertyPage
{
 DECLARE_DYNAMIC(CProp1)
public:
 CProp1();
 virtual ~CProp1();
// 对话框数据
 enum { IDD = IDD_PROP1 };
protected:
 virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
 DECLARE_MESSAGE_MAP()
};

 

// PropDoc.h : CPropDoc 类的接口
#pragma once
class CPropDoc : public CDocument
{
protected: // 仅从序列化创建
 CPropDoc();
 DECLARE_DYNCREATE(CPropDoc)
// 属性
public:
// 操作
public:
// 重写
public:
 virtual BOOL OnNewDocument();
 virtual void Serialize(CArchive& ar);
// 实现
public:
 virtual ~CPropDoc();
#ifdef _DEBUG
 virtual void AssertValid() const;
 virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
 DECLARE_MESSAGE_MAP()
};


//PropShet.h
#pragma once
// CPropSheet
#include "Prop.h"
#include "Prop1.h"
class CPropSheet : public CPropertySheet
{
 DECLARE_DYNAMIC(CPropSheet)
public:
 CPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
 CPropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); 
 CProp1 m_prop1;
 virtual ~CPropSheet();
protected:
 DECLARE_MESSAGE_MAP()
};

 

// PropView.h : CPropView 类的接口
#pragma once
class CPropView : public CView
{
protected: // 仅从序列化创建
 CPropView();
 DECLARE_DYNCREATE(CPropView)
// 属性
public:
 CPropDoc* GetDocument() const;
// 操作
public:
// 重写
public:
 virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
 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);
// 实现
public:
 virtual ~CPropView();
#ifdef _DEBUG
 virtual void AssertValid() const;
 virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
 DECLARE_MESSAGE_MAP()
public:
 afx_msg void OnPropertysheet();
};
#ifndef _DEBUG  // PropView.cpp 中的调试版本
inline CPropDoc* CPropView::GetDocument() const
   { return reinterpret_cast<CPropDoc*>(m_pDocument); }
#endif

 

//Resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Prop.rc
//
#define IDD_ABOUTBOX                    100
#define IDP_OLE_INIT_FAILED             100
#define IDD_PROP1                       107
#define IDR_MAINFRAME                   128
#define IDR_PropTYPE                    129
#define ID_32771                        32771

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        130
#define _APS_NEXT_COMMAND_VALUE         32772
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif


//stdafx.h
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
#define _AFX_ALL_WARNINGS
#include <afxwin.h>         // MFC 核心组件和标准组件
#include <afxext.h>         // MFC 扩展
#include <afxdisp.h>        // MFC 自动化类
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>                     // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxdlgs.h>
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:/"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'/"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:/"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'/"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:/"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'/"")
#else
#pragma comment(linker,"/manifestdependency:/"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'/"")
#endif
#endif

 

//targetver.h
#pragma once
// 以下宏定义要求的最低平台。要求的最低平台
// 是具有运行应用程序所需功能的 Windows、Internet Explorer 等产品的
// 最早版本。通过在指定版本及更低版本的平台上启用所有可用的功能,宏可以
// 正常工作。
// 如果必须要针对低于以下指定版本的平台,请修改下列定义。
// 有关不同平台对应值的最新信息,请参考 MSDN。
#ifndef WINVER                          // 指定要求的最低平台是 Windows Vista。
#define WINVER 0x0600           // 将此值更改为相应的值,以适用于 Windows 的其他版本。
#endif
#ifndef _WIN32_WINNT            // 指定要求的最低平台是 Windows Vista。
#define _WIN32_WINNT 0x0600     // 将此值更改为相应的值,以适用于 Windows 的其他版本。
#endif
#ifndef _WIN32_WINDOWS          // 指定要求的最低平台是 Windows 98。
#define _WIN32_WINDOWS 0x0410 // 将此值更改为适当的值,以适用于 Windows Me 或更高版本。
#endif
#ifndef _WIN32_IE                       // 指定要求的最低平台是 Internet Explorer 7.0。
#define _WIN32_IE 0x0700        // 将此值更改为相应的值,以适用于 IE 的其他版本。
#endif

 

// MainFrm.cpp : CMainFrame 类的实现
#include "stdafx.h"
#include "Prop.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
 ON_WM_CREATE()
END_MESSAGE_MAP()
static UINT indicators[] =
{
 ID_SEPARATOR,           // 状态行指示器
 ID_INDICATOR_CAPS,
 ID_INDICATOR_NUM,
 ID_INDICATOR_SCRL,
};
// CMainFrame 构造/析构
CMainFrame::CMainFrame()
{
 // TODO: 在此添加成员初始化代码
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  return -1;
 if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
 {
  TRACE0("未能创建工具栏/n");
  return -1;      // 未能创建
 }
 if (!m_wndStatusBar.Create(this) ||
  !m_wndStatusBar.SetIndicators(indicators,
    sizeof(indicators)/sizeof(UINT)))
 {
  TRACE0("未能创建状态栏/n");
  return -1;      // 未能创建
 }
 // TODO: 如果不需要可停靠工具栏,则删除这三行
 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
 EnableDocking(CBRS_ALIGN_ANY);
 DockControlBar(&m_wndToolBar);
 return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if( !CFrameWnd::PreCreateWindow(cs) )
  return FALSE;
 // TODO: 在此处通过修改
 //  CREATESTRUCT cs 来修改窗口类或样式
 return TRUE;
}
// CMainFrame 诊断
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
 CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
 CFrameWnd::Dump(dc);
}
#endif //_DEBUG
// CMainFrame 消息处理程序

 


// Prop.cpp : 定义应用程序的类行为。
#include "stdafx.h"
#include "Prop.h"
#include "MainFrm.h"
#include "PropDoc.h"
#include "PropView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CPropApp
BEGIN_MESSAGE_MAP(CPropApp, CWinApp)
 ON_COMMAND(ID_APP_ABOUT, &CPropApp::OnAppAbout)
 // 基于文件的标准文档命令
 ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
 ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
 // 标准打印设置命令
 ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
// CPropApp 构造
CPropApp::CPropApp()
{
 // TODO: 在此处添加构造代码,
 // 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 CPropApp 对象
CPropApp theApp;
// CPropApp 初始化
BOOL CPropApp::InitInstance()
{
 // 如果一个运行在 Windows XP 上的应用程序清单指定要
 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
 //则需要 InitCommonControlsEx()。否则,将无法创建窗口。
 INITCOMMONCONTROLSEX InitCtrls;
 InitCtrls.dwSize = sizeof(InitCtrls);
 // 将它设置为包括所有要在应用程序中使用的
 // 公共控件类。
 InitCtrls.dwICC = ICC_WIN95_CLASSES;
 InitCommonControlsEx(&InitCtrls);

 CWinApp::InitInstance();

 // 初始化 OLE 库
 if (!AfxOleInit())
 {
  AfxMessageBox(IDP_OLE_INIT_FAILED);
  return FALSE;
 }
 AfxEnableControlContainer();
 // 标准初始化
 // 如果未使用这些功能并希望减小
 // 最终可执行文件的大小,则应移除下列
 // 不需要的特定初始化例程
 // 更改用于存储设置的注册表项
 // TODO: 应适当修改该字符串,
 // 例如修改为公司或组织名
 SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
 LoadStdProfileSettings(4);  // 加载标准 INI 文件选项(包括 MRU)
 // 注册应用程序的文档模板。文档模板
 // 将用作文档、框架窗口和视图之间的连接
 CSingleDocTemplate* pDocTemplate;
 pDocTemplate = new CSingleDocTemplate(
  IDR_MAINFRAME,
  RUNTIME_CLASS(CPropDoc),
  RUNTIME_CLASS(CMainFrame),       // 主 SDI 框架窗口
  RUNTIME_CLASS(CPropView));
 if (!pDocTemplate)
  return FALSE;
 AddDocTemplate(pDocTemplate);
 // 分析标准外壳命令、DDE、打开文件操作的命令行
 CCommandLineInfo cmdInfo;
 ParseCommandLine(cmdInfo)
 // 调度在命令行中指定的命令。如果
 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
 if (!ProcessShellCommand(cmdInfo))
  return FALSE;
 // 唯一的一个窗口已初始化,因此显示它并对其进行更新
 m_pMainWnd->ShowWindow(SW_SHOW);
 m_pMainWnd->UpdateWindow();
 // 仅当具有后缀时才调用 DragAcceptFiles
 //  在 SDI 应用程序中,这应在 ProcessShellCommand 之后发生
 return TRUE;
}
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialog
{
public:
 CAboutDlg();
// 对话框数据
 enum { IDD = IDD_ABOUTBOX };
protected:
 virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
// 实现
protected:
 DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
 CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// 用于运行对话框的应用程序命令
void CPropApp::OnAppAbout()
{
 CAboutDlg aboutDlg;
 aboutDlg.DoModal();
}
// CPropApp 消息处理程序

 

// Prop1.cpp : 实现文件
#include "stdafx.h"
#include "Prop.h"
#include "Prop1.h"
// CProp1 对话框
IMPLEMENT_DYNAMIC(CProp1, CPropertyPage)

CProp1::CProp1()
 : CPropertyPage(CProp1::IDD)
{

}
CProp1::~CProp1()
{
}
void CProp1::DoDataExchange(CDataExchange* pDX)
{
 CPropertyPage::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CProp1, CPropertyPage)
END_MESSAGE_MAP()
// CProp1 消息处理程序

 


// PropDoc.cpp : CPropDoc 类的实现
#include "stdafx.h"
#include "Prop.h"
#include "PropDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CPropDoc
IMPLEMENT_DYNCREATE(CPropDoc, CDocument)
BEGIN_MESSAGE_MAP(CPropDoc, CDocument)
END_MESSAGE_MAP()
// CPropDoc 构造/析构
CPropDoc::CPropDoc()
{
 // TODO: 在此添加一次性构造代码
}
CPropDoc::~CPropDoc()
{}
BOOL CPropDoc::OnNewDocument()
{
 if (!CDocument::OnNewDocument())
  return FALSE;

 // TODO: 在此添加重新初始化代码
 // (SDI 文档将重用该文档)

 return TRUE;
}
// CPropDoc 序列化
void CPropDoc::Serialize(CArchive& ar)
{
 if (ar.IsStoring())
 {
  // TODO: 在此添加存储代码
 }
 else
 {
  // TODO: 在此添加加载代码
 }
}
// CPropDoc 诊断
#ifdef _DEBUG
void CPropDoc::AssertValid() const
{
 CDocument::AssertValid();
}
void CPropDoc::Dump(CDumpContext& dc) const
{
 CDocument::Dump(dc);
}
#endif //_DEBUG
// CPropDoc 命令

 


// PropSheet.cpp : 实现文件
#include "stdafx.h"
#include "Prop.h"
#include "PropSheet.h"
// CPropSheet
IMPLEMENT_DYNAMIC(CPropSheet, CPropertySheet)
CPropSheet::CPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
 :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
 // CClientDC dc(this);
 //MessageBox("test");
 //dc.TextOut(0,0,(CString)"test"); 
 AddPage(&m_prop1);
}
CPropSheet::CPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
 :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
 AddPage(&m_prop1);
}
CPropSheet::~CPropSheet()
{}
BEGIN_MESSAGE_MAP(CPropSheet, CPropertySheet)
END_MESSAGE_MAP()
// CPropSheet 消息处理程序

 


// PropView.cpp : CPropView 类的实现
#include "stdafx.h"
#include "Prop.h"
#include "PropDoc.h"
#include "PropView.h"
#include "PropSheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CPropView
IMPLEMENT_DYNCREATE(CPropView, CView)
BEGIN_MESSAGE_MAP(CPropView, CView)
 // 标准打印命令
 ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
 ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
 ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CView::OnFilePrintPreview)
 ON_COMMAND(ID_32771, &CPropView::OnPropertysheet)
END_MESSAGE_MAP()
// CPropView 构造/析构
CPropView::CPropView()
{
 // TODO: 在此处添加构造代码
}
CPropView::~CPropView()
{}
BOOL CPropView::PreCreateWindow(CREATESTRUCT& cs)
{
 // TODO: 在此处通过修改
 //  CREATESTRUCT cs 来修改窗口类或样式

 return CView::PreCreateWindow(cs);
}
// CPropView 绘制
void CPropView::OnDraw(CDC* /*pDC*/)
{
 CPropDoc* pDoc = GetDocument();
 ASSERT_VALID(pDoc);
 if (!pDoc)
  return;

 // TODO: 在此处为本机数据添加绘制代码
}
// CPropView 打印
BOOL CPropView::OnPreparePrinting(CPrintInfo* pInfo)
{
 // 默认准备
 return DoPreparePrinting(pInfo);
}
void CPropView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
 // TODO: 添加额外的打印前进行的初始化过程
}
void CPropView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
 // TODO: 添加打印后进行的清理过程
}
// CPropView 诊断
#ifdef _DEBUG
void CPropView::AssertValid() const
{
 CView::AssertValid();
}
void CPropView::Dump(CDumpContext& dc) const
{
 CView::Dump(dc);
}
CPropDoc* CPropView::GetDocument() const // 非调试版本是内联的
{
 ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPropDoc)));
 return (CPropDoc*)m_pDocument;
}
#endif //_DEBUG
// CPropView 消息处理程序
void CPropView::OnPropertysheet()
{
 //MessageBox("test");
 CPropSheet propSheet(ID_32771,GetParent(),0);
 propSheet.DoModal();
 // TODO: 在此添加命令处理程序代码
 //CClientDC dc(this);
 //MessageBox("test");
 //dc.TextOut(0,0,(CString)"test");  
}

 

// stdafx.cpp : 只包括标准包含文件的源文件
// Prop.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值