⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_21117.htm

📁 一些关于vc的问答
💻 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 '-&gt;m_strEdit1' must point to class/struct/union<BR>C:\vcpp32\text\ex7a\ex7aView.cpp(110) : error C2227: left of '-&gt;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 &gt; 1000<BR>#pragma once<BR>#endif // _MSC_VER &gt; 1000<BR><BR>class CEx07aDialog;<BR>class CEx7aView : public CView<BR>{<BR>private:CEx07aDialog* m_pDlg;<BR><BR>protected: // create from serialization only<BR>&nbsp;&nbsp;&nbsp;&nbsp;CEx7aView();<BR>&nbsp;&nbsp;&nbsp;&nbsp;DECLARE_DYNCREATE(CEx7aView)<BR><BR>// Attributes<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;CEx7aDoc* GetDocument();<BR><BR>// Operations<BR>public:<BR><BR>// Overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;// ClassWizard generated virtual function overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_VIRTUAL(CEx7aView)<BR>&nbsp;&nbsp;&nbsp;&nbsp;public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void OnDraw(CDC* pDC);&nbsp;&nbsp;// overridden to draw this view<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL PreCreateWindow(CREATESTRUCT&amp; cs);<BR>&nbsp;&nbsp;&nbsp;&nbsp;protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_VIRTUAL<BR><BR>// Implementation<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual ~CEx7aView();<BR>#ifdef _DEBUG<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void AssertValid() const;<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void Dump(CDumpContext&amp; dc) const;<BR>#endif<BR><BR>protected:<BR><BR>// Generated message map functions<BR>protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG(CEx7aView)<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnLButtonDown(UINT nFlags, CPoint point);<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnRButtonDown(UINT nFlags, CPoint point);<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg LRESULT OnGoodbye(WPARAM wParam, LPARAM lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;DECLARE_MESSAGE_MAP()<BR>};<BR><BR>#ifndef _DEBUG&nbsp;&nbsp;// debug version in ex7aView.cpp<BR>inline CEx7aDoc* CEx7aView::GetDocument()<BR>&nbsp;&nbsp; { 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>&nbsp;&nbsp;&nbsp;&nbsp;ON_MESSAGE(WM_GOODBYE, OnGoodbye)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG_MAP(CEx7aView)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_LBUTTONDOWN()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_RBUTTONDOWN()<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG_MAP<BR><BR>END_MESSAGE_MAP()<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView construction/destruction<BR><BR>CEx7aView::CEx7aView()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// 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&amp; cs)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Modify the Window class or styles here by modifying<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;the CREATESTRUCT cs<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return CView::PreCreateWindow(cs);<BR>}<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEx7aView drawing<BR><BR>void CEx7aView::OnDraw(CDC* pDC)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CEx7aDoc* pDoc = GetDocument();<BR>&nbsp;&nbsp;&nbsp;&nbsp;ASSERT_VALID(pDoc);<BR>&nbsp;&nbsp;&nbsp;&nbsp;// 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>&nbsp;&nbsp;&nbsp;&nbsp;CView::AssertValid();<BR>}<BR><BR>void CEx7aView::Dump(CDumpContext&amp; dc) const<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CView::Dump(dc);<BR>}<BR><BR>CEx7aDoc* CEx7aView::GetDocument() // non-debug version is inline<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;ASSERT(m_pDocument-&gt;IsKindOf(RUNTIME_CLASS(CEx7aDoc)));<BR>&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your message handler code here and/or call default<BR>if(m_pDlg-&gt;GetSafeHwnd()==0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pDlg-&gt;Create();<BR>&nbsp;&nbsp;&nbsp;&nbsp;CView::OnLButtonDown(nFlags, point);<BR>}<BR>/*<BR><BR>*/<BR>void CEx7aView::OnRButtonDown(UINT nFlags, CPoint point) <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your message handler code here and/or call default<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pDlg-&gt;DestroyWindow();<BR>&nbsp;&nbsp;&nbsp;&nbsp;CView::OnRButtonDown(nFlags, point);<BR>}<BR><BR>LRESULT CEx07aView::OnGoodbye(WPARAM wParam, LPARAM lParam)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// message received in response to modeless dialog OK<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;and Cancel buttons<BR>&nbsp;&nbsp;&nbsp;&nbsp;TRACE("CEx07aView::OnGoodbye %x, %lx\n", wParam, lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;TRACE("Dialog edit1 contents = %s\n",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(const char*) m_pDlg-&gt;m_strEdit1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pDlg-&gt;DestroyWindow();<BR>&nbsp;&nbsp;&nbsp;&nbsp;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 &gt; 1000<BR>#pragma once<BR>#endif // _MSC_VER &gt; 1000<BR><BR>class CEx07aDialog;<BR>class CEx7aView : public CView<BR>{<BR>。。。。。。<BR>这一段你把CEx07aDialog的声明去掉,然后加上:&nbsp;&nbsp;#include "Ex07aDialog.h"<BR><BR>也就是改成:<BR>// ex7aView.h : interface of the CEx7aView class<BR>//<BR>/////////////////////////////////////////////////////////////////////////////<BR>#include "Ex07aDialog.h"&nbsp;&nbsp;//////////////////<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 &gt; 1000<BR>#pragma once<BR>#endif // _MSC_VER &gt; 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>&nbsp;&nbsp; LRESULT CEx07aView::OnGoodbye(WPARAM wParam, LPARAM lParam)<BR>的CEx07aView改为CEx7aView;<BR>还有<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 + -