📄 subject_21117.htm
字号:
<p>
序号:21117 发表者:liumi 发表日期:2002-11-13 20:43:46
<br>主题:请大侠看看这是什么错
<br>内容:照书做的,可结果还是出错。谢了先!<BR>ex7aView.cpp<BR>C:\vcpp32\text\ex7a\ex7aView.cpp(103) : error C2653: 'CEx07aView' : is not a class or namespace name<BR>C:\vcpp32\text\ex7a\ex7aView.cpp(109) : error C2065: 'm_pDlg' : undeclared identifier<BR>C:\vcpp32\text\ex7a\ex7aView.cpp(109) : error C2227: left of '->m_strEdit1' must point to class/struct/union<BR>C:\vcpp32\text\ex7a\ex7aView.cpp(110) : error C2227: left of '->DestroyWindow' must point to class/struct/union<BR>Ex07aDialog.cpp<BR>Generating Code...<BR>Error executing cl.exe.<BR><BR>ex7a.exe - 4 error(s), 0 warning(s)<BR>//------------------------------------<BR><BR>// ex7aView.h : interface of the CEx7aView class<BR>//<BR>/////////////////////////////////////////////////////////////////////////////<BR>//#include "Ex07aDialog.h"<BR>#if !defined(AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_)<BR>#define AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_<BR><BR>#if _MSC_VER > 1000<BR>#pragma once<BR>#endif // _MSC_VER > 1000<BR><BR>class CEx07aDialog;<BR>class CEx7aView : public CView<BR>{<BR>private:CEx07aDialog* m_pDlg;<BR><BR>protected: // create from serialization only<BR> CEx7aView();<BR> DECLARE_DYNCREATE(CEx7aView)<BR><BR>// Attributes<BR>public:<BR> CEx7aDoc* GetDocument();<BR><BR>// Operations<BR>public:<BR><BR>// Overrides<BR> // ClassWizard generated virtual function overrides<BR> //{{AFX_VIRTUAL(CEx7aView)<BR> public:<BR> virtual void OnDraw(CDC* pDC); // overridden to draw this view<BR> virtual BOOL PreCreateWindow(CREATESTRUCT& cs);<BR> protected:<BR> //}}AFX_VIRTUAL<BR><BR>// Implementation<BR>public:<BR> virtual ~CEx7aView();<BR>#ifdef _DEBUG<BR> virtual void AssertValid() const;<BR> virtual void Dump(CDumpContext& dc) const;<BR>#endif<BR><BR>protected:<BR><BR>// Generated message map functions<BR>protected:<BR> //{{AFX_MSG(CEx7aView)<BR> afx_msg void OnLButtonDown(UINT nFlags, CPoint point);<BR> afx_msg void OnRButtonDown(UINT nFlags, CPoint point);<BR> afx_msg LRESULT OnGoodbye(WPARAM wParam, LPARAM lParam);<BR> //}}AFX_MSG<BR><BR> DECLARE_MESSAGE_MAP()<BR>};<BR><BR>#ifndef _DEBUG // debug version in ex7aView.cpp<BR>inline CEx7aDoc* CEx7aView::GetDocument()<BR> { return (CEx7aDoc*)m_pDocument; }<BR>#endif<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR><BR>//{{AFX_INSERT_LOCATION}}<BR>// Microsoft Visual C++ will insert additional declarations immediately before the previous line.<BR><BR>#endif // !defined(AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_)<BR><BR><BR>// ex7aView.cpp : implementation of the CEx7aView class<BR>//<BR><BR>#include "stdafx.h"<BR>#include "ex7a.h"<BR><BR>#include "ex7aDoc.h"<BR>#include "ex7aView.h"<BR>#include "Ex07aDialog.h"<BR>#ifdef _DEBUG<BR>#define new DEBUG_NEW<BR>#undef THIS_FILE<BR>static char THIS_FILE[] = __FILE__;<BR>#endif<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView<BR><BR>IMPLEMENT_DYNCREATE(CEx7aView, CView)<BR><BR>BEGIN_MESSAGE_MAP(CEx7aView, CView)<BR> ON_MESSAGE(WM_GOODBYE, OnGoodbye)<BR> //{{AFX_MSG_MAP(CEx7aView)<BR> ON_WM_LBUTTONDOWN()<BR> ON_WM_RBUTTONDOWN()<BR> //}}AFX_MSG_MAP<BR><BR>END_MESSAGE_MAP()<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView construction/destruction<BR><BR>CEx7aView::CEx7aView()<BR>{<BR> // TODO: add construction code here<BR>m_pDlg=new CEx07aDialog(this);<BR>}<BR><BR>CEx7aView::~CEx7aView()<BR>{delete m_pDlg;<BR>}<BR><BR>BOOL CEx7aView::PreCreateWindow(CREATESTRUCT& cs)<BR>{<BR> // TODO: Modify the Window class or styles here by modifying<BR> // the CREATESTRUCT cs<BR><BR> return CView::PreCreateWindow(cs);<BR>}<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView drawing<BR><BR>void CEx7aView::OnDraw(CDC* pDC)<BR>{<BR> CEx7aDoc* pDoc = GetDocument();<BR> ASSERT_VALID(pDoc);<BR> // TODO: add draw code for native data here<BR>}<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView diagnostics<BR><BR>#ifdef _DEBUG<BR>void CEx7aView::AssertValid() const<BR>{<BR> CView::AssertValid();<BR>}<BR><BR>void CEx7aView::Dump(CDumpContext& dc) const<BR>{<BR> CView::Dump(dc);<BR>}<BR><BR>CEx7aDoc* CEx7aView::GetDocument() // non-debug version is inline<BR>{<BR> ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx7aDoc)));<BR> return (CEx7aDoc*)m_pDocument;<BR>}<BR>#endif //_DEBUG<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView message handlers<BR><BR><BR>void CEx7aView::OnLButtonDown(UINT nFlags, CPoint point) <BR>{<BR> // TODO: Add your message handler code here and/or call default<BR>if(m_pDlg->GetSafeHwnd()==0)<BR> m_pDlg->Create();<BR> CView::OnLButtonDown(nFlags, point);<BR>}<BR>/*<BR><BR>*/<BR>void CEx7aView::OnRButtonDown(UINT nFlags, CPoint point) <BR>{<BR> // TODO: Add your message handler code here and/or call default<BR> m_pDlg->DestroyWindow();<BR> CView::OnRButtonDown(nFlags, point);<BR>}<BR><BR>LRESULT CEx07aView::OnGoodbye(WPARAM wParam, LPARAM lParam)<BR>{<BR> // message received in response to modeless dialog OK<BR> // and Cancel buttons<BR> TRACE("CEx07aView::OnGoodbye %x, %lx\n", wParam, lParam);<BR> TRACE("Dialog edit1 contents = %s\n",<BR> (const char*) m_pDlg->m_strEdit1);<BR> m_pDlg->DestroyWindow();<BR> return 0L;<BR>}<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:啊志 回复日期:2002-11-13 21:42:29
<br>内容:// ex7aView.h : interface of the CEx7aView class<BR>//<BR>/////////////////////////////////////////////////////////////////////////////<BR>//#include "Ex07aDialog.h"<BR>#if !defined(AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_)<BR>#define AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_<BR><BR>#if _MSC_VER > 1000<BR>#pragma once<BR>#endif // _MSC_VER > 1000<BR><BR>class CEx07aDialog;<BR>class CEx7aView : public CView<BR>{<BR>。。。。。。<BR>这一段你把CEx07aDialog的声明去掉,然后加上: #include "Ex07aDialog.h"<BR><BR>也就是改成:<BR>// ex7aView.h : interface of the CEx7aView class<BR>//<BR>/////////////////////////////////////////////////////////////////////////////<BR>#include "Ex07aDialog.h" //////////////////<BR>#if !defined(AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_)<BR>#define AFX_EX7AVIEW_H__323FFC2D_F283_11D6_A33B_5254AB19DF66__INCLUDED_<BR><BR>#if _MSC_VER > 1000<BR>#pragma once<BR>#endif // _MSC_VER > 1000<BR><BR>////////////////class CEx07aDialog;<BR>class CEx7aView : public CView<BR>{<BR>。。。。。。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:liumi 回复日期:2002-11-14 10:23:07
<br>内容:我改过的,仍是同样的错误
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:haitian 回复日期:2002-11-14 14:40:05
<br>内容:把你最后一个函数中<BR> LRESULT CEx07aView::OnGoodbye(WPARAM wParam, LPARAM lParam)<BR>的CEx07aView改为CEx7aView;<BR>还有<BR> TRACE("CEx07aView::OnGoodbye %x, %lx\n", wParam, lParam);<BR>语句中的CEx07aView也改为CEx7aView;
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -