Link to home
Start Free TrialLog in
Avatar of crazykz
crazykz

asked on

Newbie: Getting MyView not CView

Basic as they come:

I have created an App in Visual Studio and I'm using the following code to get the view:
CFrameWnd * pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd;
CView * pView = pFrame->GetActiveView();

The problem is that I have a function in MyView that I want to use.  When I try and type cast pView, like ((CMyView*)pView)->ProcessInput
, I get the error:
error C2065: 'CMyView' : undeclared identifier

How do I get a pointer so I can call ProcessInput in the MyView class.  Using the #include "MyView.h" doesn't work.

Thanks.

ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crazykz
crazykz

ASKER

I did find the problem and you were right that the #include should work.  The problem I had was that just including the View.h caused errors with recognizing the declaration of the CMyDocument.  I included the CMyDocument class also to the View class and the problem resolved itself.

The important part here is that I learn the correct way to do this.  I apologize for submitting this trivial question.  Thank you for your answer.