Solved

Changing a Group Box Caption...

Posted on 1998-03-11
5
353 Views
Last Modified: 2013-11-19
I think this is a simple thing to do, but I can't seem to get it working.  I am trying to change the caption that
appears at the top of a Group Box control at run time.  How do I reference the Group Box since it doesn't appear
as a control on my Dialog Box (even though it is there) when viewing it using the ClassWizard (under the
"Member Variables" tab)?  Since it doesn't appear as a control, I can't assign it a name like I can with a
ListBox or Button.  Any ideas?
0
Comment
Question by:tdiamond
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:tflai
Comment Utility
Change your group box resource ID to something like IDC_GBOX.  GetDlgItem(IDC_GBOX)->SetWindowText("Blah, Blah, Blah.");
0
 

Author Comment

by:tdiamond
Comment Utility
I tried that, and the program dies, reporting that my program performed an illegal operation.  Any ideas why that might be happening?
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
Comment Utility
It seems like you are trying to set the caption before the window exists. You should do this in OnInitDialog AFTER you call the base class. Confirm that GetDlgItem() returns a NON-NULL value.

0
 

Author Comment

by:tdiamond
Comment Utility
Sorry, the first answer proposed from tflai should of worked.  It was my fault.  I left the static control's resource ID as IDC_STATIC instead of changing it to something like ID_STATIC.  It works fine now.

Thanks everyone...
0
 
LVL 4

Expert Comment

by:tflai
Comment Utility
Oop!  There goes the points...  :-(
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

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

763 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

11 Experts available now in Live!

Get 1:1 Help Now