共享mfc库编译通过,但是静态编译报错

adsdfer 2010-10-27 01:51:23
错误是 error C2039: “classCMyPropertyPage”: 不是“CMyPropertyPage”的成员

可是我根本就没有这个叫做classCMyPropertyPage的东西。

网上查的类似的,貌似是CMyPropertyPage不支持静态?

那么要怎么改呢。
...全文
133 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
x396448534 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zgl7903 的回复:]
在MyPropertyPage.h中加入
DECLARE_DYNCREATE(CMyPropertyPage)

在MyPropertyPage.cpp中加入
IMPLEMENT_DYNCREATE(CMyPropertyPage, CPropertyPage)
[/Quote]

能详细说下DECLARE_DYNCREATE和DECLARE_DYNAMIC这2个宏的区别与应用么
zgl7903 2010-10-27
  • 打赏
  • 举报
回复
你的属性页资源的ID
adsdfer 2010-10-27
  • 打赏
  • 举报
回复
不好意思,还有,这个 enum { IDD = IDD_MY_PAGE };
指的是什么啊?
zgl7903 2010-10-27
  • 打赏
  • 举报
回复
#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)

adsdfer 2010-10-27
  • 打赏
  • 举报
回复
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 );///宏
}

真相重于对错 2010-10-27
  • 打赏
  • 举报
回复
你的代码???
zgl7903 2010-10-27
  • 打赏
  • 举报
回复
在MyPropertyPage.h中加入
DECLARE_DYNCREATE(CMyPropertyPage)

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

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧