CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: MFC View

  1. #1
    Join Date
    Apr 1999
    Posts
    10

    MFC View

    Hi,

    In a MFC Doc/View application, when I want to access a member function of the Doc class from a view class, I write :

    CMyProgramDoc* pDoc = GetDocument();

    After that, I can pass pDoc to another class and I can access member functions of CMyProgramDoc class.

    I want to do the same thing with CMyProgramView.
    How can I do that ?

    Thanks
    Claude


  2. #2
    Join Date
    May 1999
    Location
    Antwerp, Belgium
    Posts
    136

    Re: MFC View

    I do this by creating a pointermember of the Viewclass in the documentclass :

    CMyView *m_pView;



    In the OnInitialUpdate of the viewclass I set this variable as follows :

    CMyDoc *pDoc = (CMyDoc *) GetDocument();
    pDoc->m_pView = this;




    When you want to access multiple views you can use the GetNextView(), GetFirstViewPosition() methods of CDocument.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured