我要写个活页,
一,我为了多语言, 重载写了一个cpropertysheet加了如下方法:
[code]
CMultiLanguage *m_pLanguage;
bool ChangeLanguage(LANGID lngID);
bool ChangeLanguages(CString lngName);
bool AddMultiLanguagePage(ILanguagePropertyPage *ptr);
bool RemoveMultiLanguagePage(ILanguagePropertyPage *ptr);
bool RemoveMultiLanguagePage(int index);
void NotifyAllMultiLanguagePages();[/code]然后AddMultiLanguagePage这个里面的参数ILanguagePropertyPage会被存入一个vector,最多10页(个), 然后这个SHEET执行CHANGELANGUE的时候通知所有页.ILanguagePropertyPage如下:
[code]
class ILanguagePropertyPage : public CPropertyPage
{
public:
virtual void OnLanguageChanging(CMultiLanguage *lngPtr) = 0;
};[/code]我感觉这里把接口也弄个继承是不是有点怪?  而且事实上问题也在这里.
然后到写页面(PAGE)了. 如我写一个页:
[code]
class CPSPXPage1 : public ILanguagePropertyPage
{
DECLARE_DYNAMIC(CPSPXPage1)public:
CPSPXPage1();
virtual ~CPSPXPage1(); // 对话框数据
enum { IDD = IDD_DIALOG_PAGE1 };protected:
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
virtual void OnLanguageChanging(CMultiLanguage *lngPtr); //主窗口语言切换时触发 DECLARE_MESSAGE_MAP()
};[/code]
然后在CPP里面问题就来了:
[code]
IMPLEMENT_DYNAMIC(CPSPXPage1, ILanguagePropertyPage)CPSPXPage1::CPSPXPage1()
这里-----> : CPropertyPage(CPSPXPage1::IDD)
{
}
CPSPXPage1::~CPSPXPage1()
{
}
BEGIN_MESSAGE_MAP(CPSPXPage1, ILanguagePropertyPage)
END_MESSAGE_MAP()[/code]如我所标的那里, 用CPropertyPage(CPSPXPage1::IDD)这个就会提示CPropertyPage不是基类, 如果改成ILanguagePropertyPage()构造又只有两个(一个空,一个是const ILanguagePropertyPage&)这两个构造哪来的?也不知道我说清楚了没有, 请见谅, 另标识那里怎么办? 还是要改代码结构? 请指教, 谢谢.

解决方案 »

  1.   

    有没搞错啊. 怎么把代码部分加了\[code\]\[\/code\]全都没了????
    完整的见下面:我要写个活页,
    一,我为了多语言, 重载写了一个cpropertysheet加了如下方法:
    CMultiLanguage *m_pLanguage;
    bool ChangeLanguage(LANGID lngID);
    bool ChangeLanguages(CString lngName);
    bool AddMultiLanguagePage(ILanguagePropertyPage *ptr);
    bool RemoveMultiLanguagePage(ILanguagePropertyPage *ptr);
    bool RemoveMultiLanguagePage(int index);
    void NotifyAllMultiLanguagePages();然后AddMultiLanguagePage这个里面的参数ILanguagePropertyPage会被存入一个vector,最多10页(个), 然后这个SHEET执行CHANGELANGUE的时候通知所有页.ILanguagePropertyPage如下:
    class ILanguagePropertyPage : public CPropertyPage
    {
    public:
    virtual void OnLanguageChanging(CMultiLanguage *lngPtr) = 0;
    };我感觉这里把接口也弄个继承是不是有点怪?  而且事实上问题也在这里.
    然后到写页面(PAGE)了. 如我写一个页:
    class CPSPXPage1 : public ILanguagePropertyPage
    {
    DECLARE_DYNAMIC(CPSPXPage1)public:
    CPSPXPage1();
    virtual ~CPSPXPage1(); // 对话框数据
    enum { IDD = IDD_DIALOG_PAGE1 };protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
    virtual void OnLanguageChanging(CMultiLanguage *lngPtr); //主窗口语言切换时触发 DECLARE_MESSAGE_MAP()
    };
    然后在CPP里面问题就来了:
    IMPLEMENT_DYNAMIC(CPSPXPage1, ILanguagePropertyPage)CPSPXPage1::CPSPXPage1()
    这里-----> : CPropertyPage(CPSPXPage1::IDD)
    {
    }
    CPSPXPage1::~CPSPXPage1()
    {
    }
    BEGIN_MESSAGE_MAP(CPSPXPage1, ILanguagePropertyPage)
    END_MESSAGE_MAP()如我所标的那里, 用CPropertyPage(CPSPXPage1::IDD)这个就会提示CPropertyPage不是基类, 如果改成ILanguagePropertyPage()构造又只有两个(一个空,一个是const ILanguagePropertyPage&)这两个构造哪来的?也不知道我说清楚了没有, 请见谅, 另标识那里怎么办? 还是要改代码结构? 请指教, 谢谢.