[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Retrieving a document pointer

Posted on 1999-01-11
5
Medium Priority
?
251 Views
Last Modified: 2010-04-02
I am trying to retrieve a pointer to the active document in my application from my CMainFrame class (which is derived from CMDIFrameWnd).
I am calling GetActiveDocument() but all Im getting is a NULL pointer. Any suggestions?
0
Comment
Question by:rangers99
  • 3
5 Comments
 
LVL 4

Accepted Solution

by:
nil_dib earned 240 total points
ID: 1181900
The documents in you MDI are associated with your CChildFrame objects (derived from CMDIChildWnd)!
So no Doc is related to your CMainFrame and you get a NULL pointer!
Call GetActiveDocument() in your CMDIChildWnd derived class and you will get the pointer to the doc attached with this class.
0
 
LVL 2

Expert Comment

by:AdrianBrown
ID: 1181901
From what I remember you need to have a CMDIChildWnd as well.  I think these are then all registered with an CMultiDocTemplate that controls the whole process.  Apart from that Ive mainly used a app wizard to generate the code for a basic mdi.  If ya want that let me know and ill email it to you
0
 

Author Comment

by:rangers99
ID: 1181902
Thanks a lot!
0
 

Author Comment

by:rangers99
ID: 1181903
Thanks a lot!
0
 

Author Comment

by:rangers99
ID: 1181904
Thanks a lot!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

830 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