Solved

How to get doc pointer in a view

Posted on 1998-12-04
4
186 Views
Last Modified: 2013-11-20
In CView derived class i need to get a pointer to the associated document. How to do it?
0
Comment
Question by:jmartins71
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Bridge
ID: 1325765
GetDocument()
0
 

Author Comment

by:jmartins71
ID: 1325766
Thanks Bridge but i need more information.

My cview derived class is CSpyLoaderView
My cdocument derived class is CSpyLoaderDoc

in CSpyLoaderView i have the following inline function

CSpyLoaderDoc* GetDocument() {return (CSpyLoaderDoc*)GetDocument();}

When i call GetDocument i trigger a stack overflow exception.
Is the casting incorrect?
Can you give me a line.
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 0 total points
ID: 1325767
The answer is that the cast is correct, but the code is wrong, change to

CSpyLoaderDoc* GetDocument() {return (CSpyLoaderDoc*)m_pDocument; }


The reason you get a stack overflow is there is infinite recursion in your code, GetDocument calls itself add infinitum (filling the stack till your program crashes)

0
 

Author Comment

by:jmartins71
ID: 1325768
Thanks Answer2000
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now