?
Solved

Changing a Group Box Caption...

Posted on 1998-03-11
5
Medium Priority
?
360 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
[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
  • 2
5 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:tdiamond
ID: 1316926
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 200 total points
ID: 1316927
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
ID: 1316928
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
ID: 1316929
Oop!  There goes the points...  :-(
0

Featured Post

Technology Partners: 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

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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 will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 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