Link to home
Start Free TrialLog in
Avatar of luckie
luckie

asked on

GetDocument() Question

CmfcDoc* CFrontEnd::GetDocument() const
{
//      ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CmfcDoc)));
      return (CmfcDoc*)m_pDocument;
}

CmfcDoc* pDoc=(CmfcDoc*) GetDocument();

I wanna get some data items from CDoument class while not from CView class, how do I achieve this? Thanks
Jack
Avatar of AlexFM
AlexFM

From any place of CView-derived class you can use GetDocument function to access the document class:

void CFrontEnd::AnyFunction()
{
    GetDocument()->SomeFunction();  // access document functions and members
}
Avatar of luckie

ASKER

Hi Alex,
Mine is not a CView-derived. Could I do the same with any generic classes?Thanks
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

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