| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1228 人关注过本帖
标题:[求助]local !VC++中遇到的重大问题!谢谢大家!
只看楼主 加入收藏
XcTalent
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-4-12
收藏
 问题点数:0 回复次数:4 
[求助]local !VC++中遇到的重大问题!谢谢大家!

大家好,我是一名学习VC++的新手,在学习的过程中遇到了很多问题,谢谢大家的帮忙、指点、斧正,谢谢大家!!!

程序ex18View.cpp代码如下


#include "modellessdlg.h"
#include "stdafx.h"
#include "ex18.h"

#include "ex18Doc.h"
#include "ex18View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEx18View

IMPLEMENT_DYNCREATE(CEx18View, CView)

BEGIN_MESSAGE_MAP(CEx18View, CView)
ON_MESSAGE(WM_GOODBYE, OnGoodbye)
//{{AFX_MSG_MAP(CEx18View)
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEx18View construction/destruction

CEx18View::CEx18View()
{
// TODO: add construction code here
m_pDlg = new CModellessDlg(this);
}

CEx18View::~CEx18View()
{
delete m_pDlg;
}

BOOL CEx18View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CEx18View drawing

void CEx18View::OnDraw(CDC* pDC)
{
CEx18Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut(0,0,"XXXXX");
pDC->TextOut(0,50,"YYYYY");

}

/////////////////////////////////////////////////////////////////////////////
// CEx18View printing

BOOL CEx18View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}

void CEx18View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}

void CEx18View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CEx18View diagnostics

#ifdef _DEBUG
void CEx18View::AssertValid() const
{
CView::AssertValid();
}

void CEx18View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}

CEx18Doc* CEx18View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx18Doc)));
return (CEx18Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CEx18View message handlers

void CEx18View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
m_ModelDlg=new CModellessDlg(CWnd::GetDlgItem(IDD_DIALOG1));
m_ModelDlg->DoModal();
delete m_ModeDlg;
CView::OnKeyDown(nChar, nRepCnt, nFlags);
}

void CEx18View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_pDlg->GetSafeHwnd() == 0)
{
m_pDlg->Create();
}
CView::OnLButtonDown(nFlags, point);
}

void CEx18View::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_pDlg->DestroyWindow();
CView::OnRButtonDown(nFlags, point);
}
LRESULT CEx18View::OnGoodbye(WPARAM wParam, LPARAM lparam)
{
m_pDlg->DestroyWindow();
return 0L;
}


程序ex18view.h 代码如下

// ex18View.h : interface of the CEx18View class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_EX18VIEW_H__2A27F5F6_1A11_40F0_8088_D895D073130B__INCLUDED_)
#define AFX_EX18VIEW_H__2A27F5F6_1A11_40F0_8088_D895D073130B__INCLUDED_

#if _MSC_VER > 1000
#pragma once

#endif // _MSC_VER > 1000

class CModellessDlg; //我这里明明声明了的啊。可是编译的时候却说我没声明,奇怪了
//c:\ex18view.h(13) : see declaration of 'CModellessDlg'
class CEx18View : public CView

{
protected: // create from serialization only
CEx18View();
DECLARE_DYNCREATE(CEx18View)

// Attributes
public:
CEx18Doc* GetDocument();

private:
CModellessDlg* m_pDlg;
CModellessDlg* m_ModelDlg;
// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEx18View)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL

// Implementation

public:
virtual ~CEx18View();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif


// Generated message map functions
protected:
//{{AFX_MSG(CEx18View)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
afx_msg LRESULT OnGoodbye(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG // debug version in ex18View.cpp
inline CEx18Doc* CEx18View::GetDocument()
{ return (CEx18Doc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EX18VIEW_H__2A27F5F6_1A11_40F0_8088_D895D073130B__INCLUDED_)





错误提示为:

--------------------Configuration: ex18 - Win32 Debug--------------------
Compiling...
ex18.cpp
ex18View.cpp
C:\ex18View.cpp(22) : error C2065: 'WM_GOODBYE' : undeclared identifier
C:\ex18View.cpp(40) : error C2514: 'CModellessDlg' : class has no constructors
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(45) : warning C4150: deletion of pointer to incomplete type 'CModellessDlg'; no destructor called
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(115) : error C2514: 'CModellessDlg' : class has no constructors
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(116) : error C2027: use of undefined type 'CModellessDlg'
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(116) : error C2227: left of '->DoModal' must point to class/struct/union
C:\ex18View.cpp(117) : error C2065: 'm_ModeDlg' : undeclared identifier
C:\ex18View.cpp(117) : error C2541: delete : cannot delete objects that are not pointers
C:\ex18View.cpp(124) : error C2027: use of undefined type 'CModellessDlg'
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(124) : error C2227: left of '->GetSafeHwnd' must point to class/struct/union
C:\ex18View.cpp(126) : error C2027: use of undefined type 'CModellessDlg'
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(126) : error C2227: left of '->Create' must point to class/struct/union
C:\ex18View.cpp(134) : error C2027: use of undefined type 'CModellessDlg'
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(134) : error C2227: left of '->DestroyWindow' must point to class/struct/union
C:\ex18View.cpp(139) : error C2027: use of undefined type 'CModellessDlg'
c:\ex18view.h(13) : see declaration of 'CModellessDlg'
C:\ex18View.cpp(139) : error C2227: left of '->DestroyWindow' must point to class/struct/union
Generating Code...
Error executing cl.exe.

ex18.exe - 15 error(s), 1 warning(s)





谢谢大家帮忙了!!!!!!!!!谢谢!!!!!!
搜索更多相关主题的帖子: local 
2006-04-12 23:04
XcTalent
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-4-12
收藏
得分:0 


很长,谢谢大家帮忙!小弟感激不禁!!!
2006-04-12 23:07
bfgghy
Rank: 1
等 级:新手上路
帖 子:75
专家分:0
注 册:2006-3-25
收藏
得分:0 
1、WM_GOODBYE是什么东东,用户自定义消息没有定义
2、CModellessDlg是什么类,如果是对话框的话,应该继承于CDialog,而且只定义了类名,没有定义成员,也没有类的实现部分,你用这个类对象指针调用了那么多函数,而这些都没有定义。

[此贴子已经被作者于2006-4-13 11:19:35编辑过]

2006-04-13 11:19
pwg80
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-4-27
收藏
得分:0 

呵,楼主和我看的是一本书啊
书上这个程序好像有问题
我的也运行不了
创建不了非模式的对话框

还有一句不明白
在modellessdlg.cpp中

return CDialog::Create(CModellessDlg::IDD); 这里为什么是IDD,不是IDD_DIALOG1.
IDD代表什么????

2007-02-03 21:04
我爱奶牛
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-2-3
收藏
得分:0 

请问各位大虾!我现在在看 人邮的VC++数字图象处理  遇到一个问题,就是维纳滤波中 有一个srand ((unsigned)time(null)) 感觉有没有没什么关系啊,不知道有什么用啊! 这个函数就在滤波程序中间.请教啊!

2007-02-03 21:52
快速回复:[求助]local !VC++中遇到的重大问题!谢谢大家!
数据加载中...
 
   



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

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