| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 738 人关注过本帖
标题:MFC中的问题
取消只看楼主 加入收藏
zhengjun19
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-11-15
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
MFC中的问题
// Demo1Doc.cpp : implementation of the CDemo1Doc class
//

#include "stdafx.h"
#include "Demo1.h"

#include "Demo1Doc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDemo1Doc

IMPLEMENT_DYNCREATE(CDemo1Doc, CDocument)

BEGIN_MESSAGE_MAP(CDemo1Doc, CDocument)
    //{{AFX_MSG_MAP(CDemo1Doc)
        // NOTE - the ClassWizard will add and remove mapping macros here.
        //    DO NOT EDIT what you see in these blocks of generated code!
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDemo1Doc construction/destruction

CDemo1Doc::CDemo1Doc()
{
    // TODO: add one-time construction code here
     m_dib = new ImageDib;
}

CDemo1Doc::~CDemo1Doc()
{
    if(m_dib != NULL)
    {
        delete m_dib;
        m_dib = 0;

    }
}

BOOL CDemo1Doc::OnNewDocument()
{
    if (!CDocument::OnNewDocument())
        return FALSE;

    // TODO: add reinitialization code here
    // (SDI documents will reuse this document)

    return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CDemo1Doc serialization

void CDemo1Doc::Serialize(CArchive& ar)
{
    if (ar.IsStoring())
    {
        // TODO: add storing code here
    }
    else
    {
        // TODO: add loading code here
    }
}

/////////////////////////////////////////////////////////////////////////////
// CDemo1Doc diagnostics

#ifdef _DEBUG
void CDemo1Doc::AssertValid() const
{
    CDocument::AssertValid();
}

void CDemo1Doc::Dump(CDumpContext& dc) const
{
    CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDemo1Doc commands

BOOL CDemo1Doc::OnOpenDocument(LPCTSTR lpszPathName)
{
    if (m_dib.Read(lpszPathName) == TRUE)
    {
        SetModifiedFlag(FALSE);
        return FALSE;
    }
    else
   
    return 0;
}

BOOL CDemo1Doc::OnSaveDocument(LPCTSTR lpszPathName)
{
    if(m_dib.Write(lpszPathName)==TRUE)
    {
        SetModifiedFlag(FALSE);
        return TRUE;
    }
    else
        return 0;
}
红的地方报这些错误:\image\imagecpp\Demo2\Demo1Doc.cpp(33) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class ImageDib *' (or there is no acceptable conversion)
E:\image\imagecpp\Demo2\Demo1Doc.cpp(38) : error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class ImageDib' (or there is no acceptable conversion)
E:\image\imagecpp\Demo2\Demo1Doc.cpp(40) : error C2440: 'delete' : cannot convert from 'class ImageDib' to ''
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
E:\image\imagecpp\Demo2\Demo1Doc.cpp(40) : fatal error C1903: unable to recover from previous error(s); stopping compilation
如何修改呀?好多不懂的 请高手解答
搜索更多相关主题的帖子: include 
2011-11-15 21:51
快速回复:MFC中的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040192 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved