Solved

get a handler of Document in a user defined class

Posted on 1998-12-13
2
163 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Looking for a specific application/software 2 119
modThree challenge 4 107
Unix Command -- Challenging  question 7 101
Problem to event 3 112
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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