Click here to Skip to main content
15,917,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralFinding My Window State Pin
G.O.21-Jun-04 7:50
G.O.21-Jun-04 7:50 
GeneralRe: Finding My Window State Pin
vcplusplus21-Jun-04 8:24
vcplusplus21-Jun-04 8:24 
GeneralRe: Finding My Window State Pin
G.O.21-Jun-04 10:32
G.O.21-Jun-04 10:32 
GeneralRe: Finding My Window State Pin
Ravi Bhavnani21-Jun-04 12:21
professionalRavi Bhavnani21-Jun-04 12:21 
GeneralRe: Finding My Window State Pin
vcplusplus21-Jun-04 14:34
vcplusplus21-Jun-04 14:34 
GeneralRe: Finding My Window State Pin
Michael Dunn21-Jun-04 16:56
sitebuilderMichael Dunn21-Jun-04 16:56 
GeneralMC++ library in C# -- A Challenging Problem Pin
Dr. Shim21-Jun-04 7:24
Dr. Shim21-Jun-04 7:24 
GeneralInheriting a new View Class for MDI Pin
NTense21-Jun-04 6:24
NTense21-Jun-04 6:24 
I'm getting an error when I try to inherit a new view class for a MDI application, and I can't figure out why :/ .. First I created an OpenGL viewport inherited from CView, and packed it with all kinds of functionality. It works great. But now I'm trying to derive a new view class from it, and I'm getting the following error (using VC++ 6.0 professional):


C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2039: 'classCMotionXModelView' : is not a member of 'CMotionXModelView' c:\development\motionx\motionxmodelview.h(15) : see declaration of 'CMotionXModelView'
C:\DEVELOPMENT\MotionX\MotionX.cpp(119) : error C2065: 'classCMotionXModelView' : undeclared identifier


The thing is, I'm just deriving it from a class that is fully functional, and haven't added anything except a member variable to it.

This is the view class declaration that works:
<br />
#if !defined(AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_)<br />
#define AFX_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
// MotionXGLView.h : header file<br />
//<br />
<br />
#include "gl/gl.h"<br />
#include "gl/glu.h"<br />
#include "gl/glaux.h"<br />
<br />
#include "MotionXSceneDoc.h"<br />
#include "MotionXCamera.h"<br />
#include "MotionXModel.h"	// Added by ClassView<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CMotionXGLView view<br />
<br />
// Define Viewport modes<br />
<br />
#define PERSPECTIVE		0<br />
#define	FRONT			1<br />
#define	BACK			2<br />
#define LEFT			3<br />
#define RIGHT			4<br />
#define TOP				5<br />
#define BOTTOM			6<br />
<br />
class CMotionXGLView : public CView<br />
{<br />
protected:<br />
	CMotionXGLView();           // protected constructor used by dynamic creation<br />
	DECLARE_DYNCREATE(CMotionXGLView)<br />
<br />
// Attributes<br />
public:<br />
<br />
// Operations<br />
public:<br />
	CMotionXModel model;<br />
	void DrawGrid();<br />
	<br />
	void SwitchViewportMode(unsigned int);<br />
	void DollyViewport(const float speed);<br />
	void PitchAroundPoint(const float speed);<br />
	void RotateAroundPoint(const float speed);<br />
	inline void PedistalViewport(float speed);<br />
	inline void StrafeViewport(float speed);<br />
	CMotionXCamera viewCam;<br />
	BOOL SetupPixelFormat();<br />
	<br />
// Overrides<br />
	// ClassWizard generated virtual function overrides<br />
	//{{AFX_VIRTUAL(CMotionXGLView)<br />
	public:<br />
	virtual void OnInitialUpdate();<br />
	protected:<br />
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view<br />
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);<br />
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);<br />
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);<br />
	//}}AFX_VIRTUAL<br />
<br />
// Implementation<br />
protected:<br />
	virtual ~CMotionXGLView();<br />
#ifdef _DEBUG<br />
	virtual void AssertValid() const;<br />
	virtual void Dump(CDumpContext& dc) const;<br />
#endif<br />
<br />
	// Generated message map functions<br />
protected:<br />
	BOOL m_bCursor;<br />
	double minClip, maxClip;<br />
	double orthoWidth, orthoHeight, orthoZDistance;<br />
	unsigned int m_viewportMode;<br />
	CPoint m_pointMessage;<br />
	CDC* GetDC();<br />
	unsigned int height;<br />
	unsigned int width;<br />
	GLdouble aspectRatio;<br />
	HGLRC m_hRC;		// OpenGL Rendering Context<br />
	CDC* m_pDC;			// pointer to WinGDI Device Context<br />
<br />
	//{{AFX_MSG(CMotionXGLView)<br />
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
	afx_msg void OnDestroy();<br />
	afx_msg void OnSize(UINT nType, int cx, int cy);<br />
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);<br />
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);<br />
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);<br />
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);<br />
	afx_msg void OnViewportColorchange();<br />
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);<br />
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);<br />
	afx_msg void OnViewportScreenshot();<br />
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);<br />
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);<br />
	//}}AFX_MSG<br />
	DECLARE_MESSAGE_MAP()<br />
};<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_MOTIONXGLVIEW_H__A90B4B55_D9F7_4DD4_A776_7EDC323D4724__INCLUDED_)<br />
<br />


This is the derived class.
<br />
// MotionXModelView.h: interface for the CMotionXModelView class.<br />
//<br />
//////////////////////////////////////////////////////////////////////<br />
<br />
#if !defined(AFX_MOTIONXMODELVIEW_H__AEBACD4C_059E_4D0D_8F56_6A4EFD2C25E9__INCLUDED_)<br />
#define AFX_MOTIONXMODELVIEW_H__AEBACD4C_059E_4D0D_8F56_6A4EFD2C25E9__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
#include "MotionXGLView.h"<br />
#include "MotionXModel.h"	// Added by ClassView<br />
<br />
class CMotionXModelView : public CMotionXGLView  <br />
{<br />
public:<br />
	CMotionXModel model;<br />
	<br />
	//DECLARE_DYNCREATE(CMotionXModelView);<br />
	CMotionXModelView();<br />
	virtual ~CMotionXModelView();<br />
<br />
};<br />
<br />
#endif // !defined(AFX_MOTIONXMODELVIEW_H__AEBACD4C_059E_4D0D_8F56_6A4EFD2C25E9__INCLUDED_)<br />
<br />


And this is my InitInstace code in my CMotionXApp class, that should tie the new class to the new document template:
<br />
	m_pSceneTemplate = new CMultiDocTemplate(IDR_MOTIONTYPE,					// Icon type<br />
											 RUNTIME_CLASS(CMotionXSceneDoc),	// Class Reg<br />
											 RUNTIME_CLASS(CChildFrame),<br />
											 RUNTIME_CLASS(CMotionXGLView) );	// Viewclass<br />
<br />
	AddDocTemplate(m_pSceneTemplate);<br />
<br />
	<br />
	m_pModelTemplate = new CMultiDocTemplate(IDR_MOTIONTYPE,					// Icon type<br />
											 RUNTIME_CLASS(CMotionXModelDoc),	// Class Reg<br />
											 RUNTIME_CLASS(CChildFrame),<br />
											 RUNTIME_CLASS(CMotionXModelView) );	// Viewclass<br />
		<br />


Can anyone see what the problem is ??
GeneralRe: Inheriting a new View Class for MDI Pin
Ryan Binns21-Jun-04 18:34
Ryan Binns21-Jun-04 18:34 
GeneralObtainining parent process' handle Pin
Anonymous21-Jun-04 6:06
Anonymous21-Jun-04 6:06 
GeneralRe: Obtainining parent process' handle Pin
David Crow21-Jun-04 6:49
David Crow21-Jun-04 6:49 
GeneralVC++ and VB Pin
Neelesh K J Jain21-Jun-04 5:40
Neelesh K J Jain21-Jun-04 5:40 
GeneralRe: VC++ and VB Pin
Maximilien21-Jun-04 5:59
Maximilien21-Jun-04 5:59 
GeneralRe: VC++ and VB Pin
Andrew Quinn AUS21-Jun-04 6:10
Andrew Quinn AUS21-Jun-04 6:10 
GeneralRe: VC++ and VB Pin
David Crow21-Jun-04 6:36
David Crow21-Jun-04 6:36 
GeneralRe: VC++ and VB Pin
Kevin McFarlane21-Jun-04 8:23
Kevin McFarlane21-Jun-04 8:23 
GeneralRe: VC++ and VB Pin
palbano21-Jun-04 8:53
palbano21-Jun-04 8:53 
QuestionHow to detect if you are connected to internet? Pin
kfaday21-Jun-04 4:14
kfaday21-Jun-04 4:14 
AnswerRe: How to detect if you are connected to internet? Pin
22491721-Jun-04 5:14
22491721-Jun-04 5:14 
GeneralRe: How to detect if you are connected to internet? Pin
kfaday21-Jun-04 5:35
kfaday21-Jun-04 5:35 
AnswerRe: How to detect if you are connected to internet? Pin
David Crow21-Jun-04 6:44
David Crow21-Jun-04 6:44 
GeneralRe: How to detect if you are connected to internet? Pin
vcplusplus21-Jun-04 7:34
vcplusplus21-Jun-04 7:34 
GeneralRe: How to detect if you are connected to internet? Pin
David Crow21-Jun-04 8:28
David Crow21-Jun-04 8:28 
AnswerRe: How to detect if you are connected to internet? Pin
Michael Dunn21-Jun-04 16:57
sitebuilderMichael Dunn21-Jun-04 16:57 
GeneralRe: How to detect if you are connected to internet? Pin
palbano21-Jun-04 17:24
palbano21-Jun-04 17:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.