错误是 error C2039: “classCMyPropertyPage”: 不是“CMyPropertyPage”的成员可是我根本就没有这个叫做classCMyPropertyPage的东西。网上查的类似的,貌似是CMyPropertyPage不支持静态?那么要怎么改呢。

解决方案 »

  1.   

    在MyPropertyPage.h中加入
    DECLARE_DYNCREATE(CMyPropertyPage)在MyPropertyPage.cpp中加入
    IMPLEMENT_DYNCREATE(CMyPropertyPage, CPropertyPage)
      

  2.   

    DECLARE_DYNCREATE(CMyPropertyPage)
    IMPLEMENT_DYNCREATE(CMyPropertyPage, CPropertyPage)
    加入之后,报错error C2512: “CMyPropertyPage”: 没有合适的默认构造函数可用
    MyPropertyPage.h#pragma once
    #include "stdafx.h"
    class CMyPropertyPage :
    public CBCGPPropertyPage
    {
    DECLARE_DYNCREATE(CMyPropertyPage)public:
    CMyPropertyPage(UINT nIDTemplate);
    virtual ~CMyPropertyPage(void);public:
    void    SetBCGPButtonStyle(CBCGPButton& m_Button,UINT uiBmpResId,
                           CString m_tooltip);
    void    SetListCtrlStyle(CListCtrl& m_ListCtrl);
    };
    MyPropertyPage.cpp#include "StdAfx.h"
    #include ".\mypropertypage.h"
    IMPLEMENT_DYNCREATE(CMyPropertyPage, CPropertyPage)CMyPropertyPage::CMyPropertyPage(UINT nIDTemplate)
                    :CBCGPPropertyPage(nIDTemplate)
    {
    }CMyPropertyPage::~CMyPropertyPage(void)
    {
    }void CMyPropertyPage::SetBCGPButtonStyle(CBCGPButton& m_Button,UINT uiBmpResId,
    CString m_tooltip)
    {
    //m_Button.m_bTransparent = TRUE;
    //m_Button.SetFaceColor(RGB(255,255,255));
    m_Button.SetImage(uiBmpResId);
    m_Button.SetWindowText(_T(""));
    m_Button.SizeToContent();
    m_Button.SetTooltip(m_tooltip);}void CMyPropertyPage::SetListCtrlStyle(CListCtrl& m_ListCtrl)
    {
    DWORD dwStyle = GetWindowLong(m_ListCtrl, GWL_STYLE); 
    dwStyle &= ~(LVS_TYPEMASK);
    dwStyle &= ~(LVS_EDITLABELS); // Make sure we have report view and send edit label messages.
    SetWindowLong( m_ListCtrl, GWL_STYLE, 
    dwStyle | LVS_REPORT|LVS_NOLABELWRAP|LVS_SHOWSELALWAYS); // Enable the full row selection and the drag drop of headers.
    DWORD styles = LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES;
    // Use macro since this is new and not in MFC.
    ListView_SetExtendedListViewStyleEx(m_ListCtrl, styles, styles );///宏
    }
      

  3.   

    #pragma once
    #include "stdafx.h"
    class CMyPropertyPage :
        public CBCGPPropertyPage
    {
        DECLARE_DYNCREATE(CMyPropertyPage)
        enum { IDD = IDD_MY_PAGE };
    public:
        CMyPropertyPage(UINT nIDTemplate=IDD); 
        virtual ~CMyPropertyPage(void);public:
        void    SetBCGPButtonStyle(CBCGPButton& m_Button,UINT uiBmpResId,
                                   CString m_tooltip);
        void    SetListCtrlStyle(CListCtrl& m_ListCtrl);
    };.cpp
    IMPLEMENT_DYNCREATE(CMyPropertyPage, CBCGPPropertyPage)
      

  4.   

    不好意思,还有,这个  enum { IDD = IDD_MY_PAGE };
    指的是什么啊?
      

  5.   


    能详细说下DECLARE_DYNCREATE和DECLARE_DYNAMIC这2个宏的区别与应用么