Solved

get a handler of Document in a user defined class

Posted on 1998-12-13
2
158 Views
Last Modified: 2013-11-20
I have a SDI project, where I defined a class, say CMyClass,
within that class, I hope I can have a pointer to the
Document class, how can I do that ?

Your kind assistance will be highly appreciated.

Joe.
0
Comment
Question by:wangz
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 150 total points
ID: 1326141
Well, there are several ways to achieve what you want - you could e.g. pass the pointer to the class' constructor and store it, use 'GetActiveDocument()' from the frame window, the 'GetDocument()' method in 'CView()' and lots of other ways...
0
 

Author Comment

by:wangz
ID: 1326142
I got the answer by searching the MFC FAQ:

((CFrameWnd*) (AfxGetApp()->m_pMainWnd))->GetActiveDocument()

Thanks anyway, jkr.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 127
conditional code and condition difference 9 65
Line meaning 9 77
noX challenge 17 76
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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