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
Solved

get a handler of Document in a user defined class

Posted on 1998-12-13
2
161 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
has77  challenge 9 90
Line meaning 9 88
JQuery serialize and unserialize 8 136
Increment column based of a FK 8 31
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

828 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