Solved

CWinApp::OnIdle - updating active doc

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pressing cancel button with C# UI Automation 3 51
Shell script to login to remote m/c and execute commands 10 78
Problem to event 3 78
Capture logon name 13 37
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

920 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