getting active view of a mdi application

HI,
i want to get an active view of a mdi application..

CMainFrame *pFrame =
(CMainFrame*)AfxGetApp()->m_pMainWnd;

//CChildFrame *pChild = (CChildFrame*)pFrame->MDIGetActive();

CChildFrame *pChild =
(CChildFrame *) pFrame->GetActiveFrame();

CmyView *pView = (CmyView *) pChild->GetActiveView();

here pView is always getting NULL value.pls anyone suggest me
[462 byte] By [resumurof] at [2007-11-20 11:41:11]
# 1 Re: getting active view of a mdi application
Does the CmyView View exist in the moment you are trying to apply this code?
Where is this code: in the exe or dll?
Is it in the main thread or in some secondary thread?
VictorN at 2007-11-10 22:24:34 >
# 2 Re: getting active view of a mdi application
yes it is in my same project... still it is giving assertion when i try to get a GetActiveView() anyone have any idea...........

from one of the mydialog class im calling

CmyDoc* pDoc=(CmyDoc*)((CChildFrame*)AfxGetMainWnd())->GetActiveFrame();
pDoc->SelectFolder( sPath );
resumurof at 2007-11-10 22:25:34 >
# 3 Re: getting active view of a mdi application
CmyDoc* pDoc=(CmyDoc*)((CChildFrame*)AfxGetMainWnd())->GetActiveFrame();
pDoc->SelectFolder( sPath );Your code is wrong.
Why do you cast CChildFrame* pointer to CmyDoc*? :confused:
VictorN at 2007-11-10 22:26:36 >
# 4 Re: getting active view of a mdi application
im trying to get a active frame of a mdi application
resumurof at 2007-11-10 22:27:35 >
# 5 Re: getting active view of a mdi application
im trying to get a active frame of a mdi application
From where? That's important.
cilu at 2007-11-10 22:28:40 >