Solved

CWinApp::OnIdle - updating active doc

Posted on 1998-11-05
1
413 Views
Last Modified: 2013-11-20
In a MDI app, I need to make updates to the active child document in the app's OnIdle() event.  How can I get a pointer to the active document from the app class?  And, most importantly, will I be able to call functions that I have added by subclassing CMDIChildWnd when I get the pointer to it.  Also, I'm not using doc/view.  MFC is confusing the hell out of me, so any help would be wonderful!
0
Comment
Question by:dolce
1 Comment
 
LVL 1

Accepted Solution

by:
TheGrinch earned 50 total points
ID: 1324256
In your App class, GetMainWnd() returns a CWnd* pointer to your main window, so it needs to be cast...

   CMDIFrameWnd* mainwnd = (CMDIFrameWnd*)GetMainWnd();

Then, get the document with...

   CMyDocument* doc = (CMyDocument*)mainwnd->GetActiveDocument();

And get the view with...

   CMyView* view = (CMyView*)mainwnd->GetActiveView();

Get the child window with...

   CMDIChildWnd* child = (CMDIChildWnd*)view->GetParent();

You should be able to call the functions...

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 49
Define unique primary key 9 92
format the code in java 6 93
child constructor and parent constructor, overriding and overloading 6 84
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

776 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