Re: MFC Newbie Question - Getting pointer to View Class from theApp

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 3 Mar 2006 13:31:55 -0800, kstahl@xxxxxxxxx wrote:

I created an SDI application using the wizard. The view class is
derived from CEditView. I want a pointer to my view class to call some
member functions. So I added a member variable to the App class that
was a pointer of type View. After doing this, I get compiler errors
C2143 and C2501 in the header file of my view class where it declares
the GetDocument(); function. I think I've got some kind of circular
reference thing going on here but am missing something simple.

class CTest2App : public CWinApp
{
public:
CTest2App();

CTest2View* theView; // This is what I added
snip
};


class CTest2View : public CEditView
{
protected: // create from serialization only
CTest2View();
DECLARE_DYNCREATE(CTest2View)

// Attributes
public:
CTest2Doc* GetDocument();
snip
};

This may help:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_relationships_among_mfc_objects.asp>
.



Relevant Pages