自己写的从CView类居然RUNTIME_CLASS( )宏不认识????

FindPopy 2005-06-20 08:33:40
我从CView派生了一个类,改写了很多派生时产生的代码,但是,现在RUNTIME_CLASS( )居然不认识该派生类?
请教高手,从MFC派生时,怎样才能让派生类被RUNTIME_CLASS()宏所识别?

谢谢!在线等待至10点。
...全文
57 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
truewill 2005-06-20
  • 打赏
  • 举报
回复
估计是调用的文件没有 #include "ogview.h" 吧
FindPopy 2005-06-20
  • 打赏
  • 举报
回复
m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(COGView),CSize(400,300),pContext);
报错:error C2653: 'COGView' : is not a class or namespace name
我的COGView类有点大,是先删除VC自己的代码后从写的
定义如下:
class COGView : public CView
{
protected:
COGView();
DECLARE_DYNCREATE(COGView)
public:
//======== New data
long m_BkClr; // Background color
HGLRC m_hRC; // Rendering context OpenGL
HDC m_hdc; // Windows device context
GLfloat m_AngleX; // Rotation angle (around X-axis)
GLfloat m_AngleY; // Rotation angle (around Y-axis)
GLfloat m_AngleView; // Perspective angle
GLfloat m_fRangeX; // Graphics dimension (along X-axis)
GLfloat m_fRangeY; // Graphics dimension (along Y-axis)
GLfloat m_fRangeZ; // Graphics dimension (along Z-axis)
GLfloat m_dx; // Displacement quantum (along X-axis)
GLfloat m_dy; // Displacement quantum (along Y-axis)
GLfloat m_xTrans; // Displacement (along X-axis)
GLfloat m_yTrans; // Displacement (along Y-axis)
GLfloat m_zTrans; // Displacement (along Z-axis)
GLenum m_FillMode; // Polygon filling mode
bool m_bCaptured; // Mouse capture flag
bool m_bRightButton; // Right mouse button flag
bool m_bQuad; // Flag of using GL_QUAD (instead of GL_QUAD_STRIP)
CPoint m_pt; // Current mouse position
UINT m_xSize; // Current client window sixe (along X-axis)
UINT m_zSize; // Current client window sixe (along -axis)
vector < CPoint3D > m_cPoints; // Graphics dimension (along X-axis)
int m_LightParam[11]; // Graphics dimension (along X-axis)
CPropDlg *m_pDlg; // Graphics dimension (along X-axis)

//======== Public methods
COGDoc* GetDocument() { return DYNAMIC_DOWNCAST(COGDoc,m_pDocument); }
virtual ~COGView();

//======== New methods
void DrawScene(); // Prepare and store the image
bool DefaultGraphic(); // Create and save the default plot
void ReadData(); // Data-file manipulations
bool DoRead(HANDLE hFile); // Data-file reading
//===== Take the data from buffer and store in m_cPoints
void SetGraphPoints(BYTE* buff, DWORD nSize);
void SetLightParam (short lp, int nPos); // Set lighting parameters
void GetLightParams(int *pPos); // Get lighting parameters
void SetLight(); // Set the lighting
void SetBkColor(); // Set background color
void LimitAngles(); // Limit rotation angles

//{{AFX_VIRTUAL(COGView)
public:
virtual void OnDraw(CDC* pDC);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(COGView)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnViewQuad();
afx_msg void OnUpdateViewQuad(CCmdUI* pCmdUI);
afx_msg void OnViewFill();
afx_msg void OnUpdateViewFill(CCmdUI* pCmdUI);
afx_msg void OnEditProp();
afx_msg void OnEditBackground();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
#endif
zhoujiamurong 2005-06-20
  • 打赏
  • 举报
回复
你如何知道他不识别的?贴代玛

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧