Solved

Get pointer to CMianFrame in SDI app

Posted on 1999-01-08
3
521 Views
Last Modified: 2013-11-20
I need to get a pointer to the CMainFrame in the app class.
In a MDI app MFC does // create main MDI Frame window
                    pMainFrame = new CMainFrame; I then
save this pointer as a member of the app class. The SDI app doesn't do this. I need to access the main window's status bar in the app class of an SDI app. Can anyone help?
0
Comment
Question by:BlackRussian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Expert Comment

by:migel
ID: 1327394
AfxGetMainWnd()
0
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 1327395
Well, there are several ways to achieve what you want - you could e.g. pass the pointer to the class' constructor and store it, use 'GetActiveDocument()' from the frame window, the 'GetDocument()' method in 'CView()' and lots of other ways...

((CFrameWnd*) (AfxGetApp()->m_pMainWnd))->GetActiveDocument()

0
 
LVL 12

Expert Comment

by:migel
ID: 1327396
strane answer
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

631 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