Why is my views m_pDocument set to NULL ? 
Author Message
 Why is my views m_pDocument set to NULL ?

Hello,
Here is an easy one I hope.

 pDVTemplate->OpenDocumentFile(NULL);
 CVizDoc* pDoc = (CVizDoc*)GetDocument();

What would cause the pDoc variable to equal NULL after performing the
OpenDocumentFile method ?

In other words where and what sets the views m_pDocument variable and how
can I assign it manually if I wanted to ?

I'd appreciate any help or suggestions
Thanks



Wed, 08 Aug 2001 03:00:00 GMT  
 Why is my views m_pDocument set to NULL ?
Hello,

Here is how it works:
When the Frame is created OnCreate() of the frame calls the OnCreateClient()
of the frame.
This in turn calls the Create() for the view. This results in the OnCreate()
of the view which adds itself to the list of views in the current document.
At this point, the Document surely exists.
And the addview fucntion in turn sets the m_pDocument pointer of the view

So The FrameWnd which contains the doc should have been created. Before that
the m_pDocument is NULL.

Hope that helps,
Anupama

Quote:

>Hello,
>Here is an easy one I hope.

> pDVTemplate->OpenDocumentFile(NULL);
> CVizDoc* pDoc = (CVizDoc*)GetDocument();

>What would cause the pDoc variable to equal NULL after performing the
>OpenDocumentFile method ?

>In other words where and what sets the views m_pDocument variable and how
>can I assign it manually if I wanted to ?

>I'd appreciate any help or suggestions
>Thanks



Tue, 14 Aug 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help: m_pDocument = NULL in 2nd MFC doc template ???

2. Why does m_hWnd gets set to NULL

3. right after CView's m_pDocument is set

4. Why am I getting an ExecutionEngineException?

5. Why am I being ignored ???

6. Why am I seeing such a delay between my catch block and my finally block

7. Macro with functions problem -- why am I stupid?

8. Why am I not getting correct position?

9. Why am I getting a segmentation fault?

10. Why am I not intercepting Enter key (VK_RETURN)

11. Why am I getting a General protection Fault?

12. Why I am getting Error C2091: function returns function

 

 
Powered by phpBB® Forum Software