cbrenn
April 29th, 1999, 01:12 PM
Hi all !
Ok let me explain all that ! I have an SDI application with a Docked window like in Visual C++ for the class view and a CView. In the docked window i have a tree view. Now what i want is to get a pointer to my one and only document from that window. I have try alot of stuff but nothing is working... My last thing is to try to post a message and make the document class map this message. But i would prefer to be able to get a pointer to my document class inside my treeview class. I have the same application but its MDI. From my tree view i am able to get a pointer using this code :
// I tried this and it seems to work:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
// Get the active view attached to the active MDI child
// window.
CSDITreeTestView *pView = (CSDITreeTestView *) pChild->GetActiveView();
CSDITreeTestDoc* pDoc = pView->GetDocument();
pDoc->ChangeString("Yo !");
But this code is not working for my SDI application !
How should i do this ?
Hope someone can understand what i'm trying to do... ;)
Thanx
Charles Brenn
Ok let me explain all that ! I have an SDI application with a Docked window like in Visual C++ for the class view and a CView. In the docked window i have a tree view. Now what i want is to get a pointer to my one and only document from that window. I have try alot of stuff but nothing is working... My last thing is to try to post a message and make the document class map this message. But i would prefer to be able to get a pointer to my document class inside my treeview class. I have the same application but its MDI. From my tree view i am able to get a pointer using this code :
// I tried this and it seems to work:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
// Get the active view attached to the active MDI child
// window.
CSDITreeTestView *pView = (CSDITreeTestView *) pChild->GetActiveView();
CSDITreeTestDoc* pDoc = pView->GetDocument();
pDoc->ChangeString("Yo !");
But this code is not working for my SDI application !
How should i do this ?
Hope someone can understand what i'm trying to do... ;)
Thanx
Charles Brenn