Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

564 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