reference toolbar in sdi

Posted on 2005-03-22
Medium Priority
Last Modified: 2010-04-01
I have created a SDI application in Visual Studio 6.  Besides the menu and toolbar that the wizard creates automatically I have also created a dialog bar with one static control to display a text message.  My question is this:
   How can I reference this static control from the view class?  Is there a "parent"-type property?
Question by:danhotb1
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
LVL 55

Accepted Solution

Jaime Olivares earned 800 total points
ID: 13610680
You can use ::AfxGetMainWnd() to obtain pointer to main window (typically CMainFrame), the you can access the dialogbar directly or using a function:

((CMainFrame *)::AfxGetMainWnd())->m_wndDialogBar.SetDlgItemText(IDC_YOURSTATIC, "test");

or (prefered)

((CMainFrame *)::AfxGetMainWnd())->SetDialogBarText("test");
// where SetDialogBarText() is a custom made function to update the static control

You will need to #include "mainfrm.h" in both cases

Good luck,

Author Comment

ID: 13611788
Thanks, Jaime.  That works like a charm!  I have added some points because I'm new to this and you've really helped push our project ahead.  Thanks again.
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13611873
Glad to help you.  ;)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

777 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