Re: trying to get active view pointer from cmainframe
I am in MainFrame and i want to call view's derived classes function.
it is possible with above mentioned method.
void CMainFrame::StepLine(CString Line)
{
CTritonSpiritBoardApp *app =(CTritonSpiritBoardApp *)
AfxGetApp();
POSITION Pos = app->GetFirstDocTemplatePosition();
CDocTemplate * pTem = app->GetNextDocTemplate(Pos);
POSITION DocPos = pTem->GetFirstDocPosition();
CDocument * pDoc = pTem->GetNextDoc(DocPos);
POSITION ViewPos = pDoc->GetFirstViewPosition();
while(ViewPos != NULL)
{
CTritonSpiritBoardView * pView = (CTritonSpiritBoardView
*)pDoc->GetNextView(ViewPos);
pView->HighLightLine(Line);
}
}
but the problem is that all the messages alway's go to same view.
i will explain in detail.
//Document class
class CTritonSpiritBoardDoc : public CDocument //document class
//view class
class CTritonSpiritBoardView : public CView //view class
{
public:
void HighLightLine(Line);
}
now in this application user can open more than one files at a time
suppose (a.c) (b.c) that mean two chld window's are present and i have
created them using OpenDocumentFile("path");
i am getting filename and line no from other process.
before coming to cmainframe function i am bringing that child window to
top.
now i am in CMainFrame and i want the function in cview should get
called for
the window i just brought to front.
For this do i need to do enumeration of document objects?
but how i will make distinction i have got only file name. and that is
present on windows title and by using i have already made that window
to top.
so if know the solution please tell me.
and one more thing why that MDIGetActive() is asserting
GetActiveFrame() is also asserting.
Thanks and regards
Harshal