新人求教,学孙鑫Vc深入详解第8章遇到问题添加好属性表单这个菜单项后点击无法弹出模态对话框 按照书上语句一字一句的写,能运行就是点击属性菜单后无法弹出对应的属性表单对话框。点了后还打印显示propSheet()Failed... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 // PropSheet.cpp : 实现文件//#include "stdafx.h"#include "Prop.h"#include "PropSheet.h"// CPropSheetIMPLEMENT_DYNAMIC(CPropSheet, CPropertySheet)CPropSheet::CPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) :CPropertySheet(nIDCaption, pParentWnd, iSelectPage){ AddPage((CPropertyPage*)&m_p1); AddPage((CPropertyPage*)&m_p2); AddPage((CPropertyPage*)&m_p3);}CPropSheet::CPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) :CPropertySheet(pszCaption, pParentWnd, iSelectPage){ AddPage((CPropertyPage*)&m_p1); AddPage((CPropertyPage*)&m_p2); AddPage((CPropertyPage*)&m_p3);}CPropSheet::~CPropSheet(){}BEGIN_MESSAGE_MAP(CPropSheet, CPropertySheet)END_MESSAGE_MAP()#include "PropDoc.h"#include "PropView.h"#include "PropSheet.h"#ifdef _DEBUG#define new DEBUG_NEW#endif// CPropViewIMPLEMENT_DYNCREATE(CPropView, CView)BEGIN_MESSAGE_MAP(CPropView, CView) ON_WM_CONTEXTMENU() ON_WM_RBUTTONUP() ON_COMMAND(IDM_PROPERTYSHEET, &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: 在此处为本机数据添加绘制代码}void CPropView::OnRButtonUp(UINT /* nFlags */, CPoint point){ ClientToScreen(&point); OnContextMenu(this, point);}void CPropView::OnContextMenu(CWnd* /* pWnd */, CPoint point){#ifndef SHARED_HANDLERS theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);#endif}// CPropView 诊断#ifdef _DEBUGvoid 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(){ // TODO: 在此添加命令处理程序代码 CPropertySheet propSheet("单子"); propSheet.DoModal();} 关于报表,如何实现在报表中删除指定的行?CXTPReportControl类。 请问CMarkup不在MFC环境下怎么使用 如何通过侦听的端口获取与这个端口绑定的IP? 如何删除文档模板? 如何把BMP图片作为单文档程序的背景? 最近看到观察者模式,但是不知道怎么实现~~ 如何实现c++中的屏幕抓图,要求该屏幕在显示区域外或隐藏的。求那位大虾指点一二,不胜感谢!! 如何使用sndPlaySound???说未定义的标识符。 关于打印输出的问题 MFC中如何从文本中提取数据放在编辑框中? DirectShow 控制USB摄像头问题 求教图像处理入门的建议
//#include "stdafx.h"
#include "Prop.h"
#include "PropSheet.h"
// CPropSheetIMPLEMENT_DYNAMIC(CPropSheet, CPropertySheet)CPropSheet::CPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
AddPage((CPropertyPage*)&m_p1);
AddPage((CPropertyPage*)&m_p2);
AddPage((CPropertyPage*)&m_p3);
}
CPropSheet::CPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage((CPropertyPage*)&m_p1);
AddPage((CPropertyPage*)&m_p2);
AddPage((CPropertyPage*)&m_p3);
}
CPropSheet::~CPropSheet()
{
}
BEGIN_MESSAGE_MAP(CPropSheet, CPropertySheet)
END_MESSAGE_MAP()
#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_WM_CONTEXTMENU()
ON_WM_RBUTTONUP()
ON_COMMAND(IDM_PROPERTYSHEET, &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: 在此处为本机数据添加绘制代码
}
void CPropView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
ClientToScreen(&point);
OnContextMenu(this, point);
}void CPropView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}// 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()
{
// TODO: 在此添加命令处理程序代码
CPropertySheet propSheet("单子");
propSheet.DoModal();
}