Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get doc pointer in a view

Posted on 1998-12-04
4
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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