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.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Using #include "MyView.h" should work.

#include "stdafx.h"

// other #include

#include "MyView.h"


There is another way to do it. Use a user-defined message and post it to the view.

#define    WM_USER_PROCESSINPUT    (WM_USER + 1)



    // ...
    return 0;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
crazykzAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.