Solved

CWinApp::OnIdle - updating active doc

Posted on 1998-11-05
1
410 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

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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. …
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

9 Experts available now in Live!

Get 1:1 Help Now