Re: trying to get active view pointer from cmainframe
Hi,
Try:
POSITION Pos = GetFirstDocTemplatePosition();
CDocTemplate * pTem = GetNextDocTemplate(Pos);
POSITION DocPos = pTem->GetFirstDocPosition();
CDocument * pDoc = GetNextDoc(DocPos);
POSITION ViewPos = pDoc->GetFirstViewPosition();
while(ViewPos != NULL)
{
CView * pView = GetNextView(ViewPos);
pView->SomeFunction();
}
Jan
<harshalshete@gmail.com> wrote in message
news:1148462958.739727.302150@i39g2000cwa.googlegroups.com...
hi group,
i am programming a mdi application.
in which i want the active view's pointer.
so after searching i got this code on msdn.
void CMainFrame::StepLine(CString Line)
{
//pView->HighLightLine(Line);
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
if(pFrame)
{
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->MDIGetActive();//here it gives
//assertion as given below
if(pChild)
{
CTritonSpiritBoardView *pView = (CTritonSpiritBoardView *)
pChild->GetActiveView();
}
}
}
Debug assertion failed!
Program:
File:winmdi.cpp
Line:341
why this api is failing??
if anybody know's please tell me
Regards
Harshal Shete