scott27349
Technical User
i am getting a error using msvc++6.0, tried everything i can think of and nothing helps, i downloaded the service packs too. heres the code and the errors are at the end
// EX04CView.cpp : implementation of the CEX04CView class
//
#include "stdafx.h"
#include "EX04C.h"
#include "EX04CDoc.h"
#include "EX04CView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEX04CView
IMPLEMENT_DYNCREATE(CEX04CView, CScrollView)
BEGIN_MESSAGE_MAP(CEX04CView, CScrollView)
//{{AFX_MSG_MAP(CEX04CView)
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEX04CView construction/destruction
CEX04CView::CEX04CView() : m_rectEllipse(0, 0, 4000, -4000)
{
m_nColor = GRAY_BRUSH; // TODO: add construction code here
}
void CEX04CView::OnDraw(CDC* pDC)
{
pDC->SelectStockObject(m_nColor);
pDC->Ellipse(m_rectEllipse);
// TODO: add draw code for native data here
}
void CEX04CView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal(20000, 30000); //20 by 30 cm
CSize sizePage(sizeTotal.cx / 2, sizeTotal.cy / 2);
CSize sizeLine(sizeTotal.cx / 50, sizeTotal.cy / 50);
SetScrollSizes(MM_HIMETRIC, sizeTotal, sizePage, sizeLine);
}
/////////////////////////////////////////////////////////////////////////////
// CEX04CView printing
BOOL CEX04CView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEX04CView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEX04CView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEX04CView diagnostics
#ifdef _DEBUG
void CEX04CView::AssertValid() const
{
CScrollView::AssertValid();
}
void CEX04CView:ump(CDumpContext& dc) const
{
CScrollView:ump(dc);
}
CEX04CDoc* CEX04CView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEX04CDoc)));
return (CEX04CDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEX04CView message handlers
void CEX04CView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch (nChar) { // TODO: Add your message handler code here and/or call default
case VK_HOME:
OnVScroll(SB_TOP, 0, NULL);
OnHScroll(SB_LEFT, 0, NULL);
break;
case VK_END:
OnVScroll(SB_BOTTOM, 0, NULL);
OnHScroll(SB_RIGHT, 0, NULL);
break;
case VK_UP:
OnVScroll(SB_LINEUP, 0, NULL);
break;
case VK_DOWN:
OnVScroll(SB_LINEDOWN, 0, NULL);
break;
case VK_PRIOR:
OnVScroll(SB_PAGEUP, 0, NULL);
break;
case VK_NEXT:
OnVScroll(SB_PAGEDOWN, 0, NULL);
break;
case VK_LEFT:
OnHScroll(SB_LINELEFT, 0, NULL);
break;
case VK_RIGHT:
OnHScroll(SB_LINERIGHT, 0, NULL);
break;
default:
break;
}
}
void CEX04CView::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC dc(this);
OnPrepareDC(&dc);
CRect rectDevice = m_rectEllispe;
dc.LPtoDP(rectDevice);
if (rectDevice.PtInRect(point)) {
if (m_nColor == GRAY_BRUSH) {
m_nColor = WHITE_BRUSH;
}
else {
m_nColor = GRAY_BRUSH;
}
InvalidateRect(rectDevice);
}
}
HERE IS THE HEADER FILE
// EX04CView.h : interface of the CEX04CView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_EX04CVIEW_H__2FB8900C_FA02_417D_9670_A7CEC4CF808D__INCLUDED_)
#define AFX_EX04CVIEW_H__2FB8900C_FA02_417D_9670_A7CEC4CF808D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CEX04CView : public CScrollView
{
protected: // create from serialization only
CEX04CView();
DECLARE_DYNCREATE(CEX04CView)
// Attributes
public:
CEX04CDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEX04CView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CEX04CView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CEX04CView)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private: CRect m_rectEllipse;
int m_nColor;
};
#ifndef _DEBUG // debug version in EX04CView.cpp
inline CEX04CDoc* CEX04CView::GetDocument()
{ return (CEX04CDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EX04CVIEW_H__2FB8900C_FA02_417D_9670_A7CEC4CF808D__INCLUDED_)
HERE IS THE ERROR'S AND CODES
--------------------Configuration: EX04C - Win32 Debug--------------------
Compiling...
EX04C.cpp
EX04CView.cpp
C:\EX04C\EX04CView.cpp(139) : error C2065: 'm_rectEllispe' : undeclared identifier
C:\EX04C\EX04CView.cpp(139) : error C2440: 'initializing' : cannot convert from 'int' to 'class CRect'
No constructor could take the source type, or constructor overload resolution was ambiguous
Generating Code...
Error executing cl.exe.
EX04C.exe - 2 error(s), 0 warning(s)
// EX04CView.cpp : implementation of the CEX04CView class
//
#include "stdafx.h"
#include "EX04C.h"
#include "EX04CDoc.h"
#include "EX04CView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEX04CView
IMPLEMENT_DYNCREATE(CEX04CView, CScrollView)
BEGIN_MESSAGE_MAP(CEX04CView, CScrollView)
//{{AFX_MSG_MAP(CEX04CView)
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEX04CView construction/destruction
CEX04CView::CEX04CView() : m_rectEllipse(0, 0, 4000, -4000)
{
m_nColor = GRAY_BRUSH; // TODO: add construction code here
}
void CEX04CView::OnDraw(CDC* pDC)
{
pDC->SelectStockObject(m_nColor);
pDC->Ellipse(m_rectEllipse);
// TODO: add draw code for native data here
}
void CEX04CView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal(20000, 30000); //20 by 30 cm
CSize sizePage(sizeTotal.cx / 2, sizeTotal.cy / 2);
CSize sizeLine(sizeTotal.cx / 50, sizeTotal.cy / 50);
SetScrollSizes(MM_HIMETRIC, sizeTotal, sizePage, sizeLine);
}
/////////////////////////////////////////////////////////////////////////////
// CEX04CView printing
BOOL CEX04CView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEX04CView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEX04CView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEX04CView diagnostics
#ifdef _DEBUG
void CEX04CView::AssertValid() const
{
CScrollView::AssertValid();
}
void CEX04CView:ump(CDumpContext& dc) const
{
CScrollView:ump(dc);
}
CEX04CDoc* CEX04CView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEX04CDoc)));
return (CEX04CDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEX04CView message handlers
void CEX04CView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch (nChar) { // TODO: Add your message handler code here and/or call default
case VK_HOME:
OnVScroll(SB_TOP, 0, NULL);
OnHScroll(SB_LEFT, 0, NULL);
break;
case VK_END:
OnVScroll(SB_BOTTOM, 0, NULL);
OnHScroll(SB_RIGHT, 0, NULL);
break;
case VK_UP:
OnVScroll(SB_LINEUP, 0, NULL);
break;
case VK_DOWN:
OnVScroll(SB_LINEDOWN, 0, NULL);
break;
case VK_PRIOR:
OnVScroll(SB_PAGEUP, 0, NULL);
break;
case VK_NEXT:
OnVScroll(SB_PAGEDOWN, 0, NULL);
break;
case VK_LEFT:
OnHScroll(SB_LINELEFT, 0, NULL);
break;
case VK_RIGHT:
OnHScroll(SB_LINERIGHT, 0, NULL);
break;
default:
break;
}
}
void CEX04CView::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC dc(this);
OnPrepareDC(&dc);
CRect rectDevice = m_rectEllispe;
dc.LPtoDP(rectDevice);
if (rectDevice.PtInRect(point)) {
if (m_nColor == GRAY_BRUSH) {
m_nColor = WHITE_BRUSH;
}
else {
m_nColor = GRAY_BRUSH;
}
InvalidateRect(rectDevice);
}
}
HERE IS THE HEADER FILE
// EX04CView.h : interface of the CEX04CView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_EX04CVIEW_H__2FB8900C_FA02_417D_9670_A7CEC4CF808D__INCLUDED_)
#define AFX_EX04CVIEW_H__2FB8900C_FA02_417D_9670_A7CEC4CF808D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CEX04CView : public CScrollView
{
protected: // create from serialization only
CEX04CView();
DECLARE_DYNCREATE(CEX04CView)
// Attributes
public:
CEX04CDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEX04CView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CEX04CView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CEX04CView)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private: CRect m_rectEllipse;
int m_nColor;
};
#ifndef _DEBUG // debug version in EX04CView.cpp
inline CEX04CDoc* CEX04CView::GetDocument()
{ return (CEX04CDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EX04CVIEW_H__2FB8900C_FA02_417D_9670_A7CEC4CF808D__INCLUDED_)
HERE IS THE ERROR'S AND CODES
--------------------Configuration: EX04C - Win32 Debug--------------------
Compiling...
EX04C.cpp
EX04CView.cpp
C:\EX04C\EX04CView.cpp(139) : error C2065: 'm_rectEllispe' : undeclared identifier
C:\EX04C\EX04CView.cpp(139) : error C2440: 'initializing' : cannot convert from 'int' to 'class CRect'
No constructor could take the source type, or constructor overload resolution was ambiguous
Generating Code...
Error executing cl.exe.
EX04C.exe - 2 error(s), 0 warning(s)