Solved

Retrieving a document pointer

Posted on 1999-01-11
5
233 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 60 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
passing data from one form to another form in c++ 27 82
Installshield for Embarcadero EX 10.1 Berlin 4 60
designing in object programming 12 94
Android development question 2 54
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

860 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