Solved

Retrieving a document pointer

Posted on 1999-01-11
5
223 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now