大侠一个获得文档类指针的有关问题

请教各位大侠一个获得文档类指针的问题
我想在一个多文档的view类里面获得当前文档的指针,但调试发现获得的文档指针总是为空,不知其解,以下是我的代码:
  CDIPDemoDoc* pCurrentDoc=(CDIPDemoDoc*)(((CFrameWnd*)AfxGetApp()->m_pMainWnd )->GetActiveDocument()); 
希望各位大侠能够帮我指出原因,谢谢!


------解决方案--------------------
Return Value
A pointer to the current CDocument. If there is no current document, returns NULL.