Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

get a handler of Document in a user defined class

Posted on 1998-12-13
2
Medium Priority
?
167 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
[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 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

609 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