Solved

Changing a Group Box Caption...

Posted on 1998-03-11
5
355 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
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 50 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 195
deburging in oracle form 12 98
How to determine file rename from EventLog ? 2 49
withoutTen challenge 14 120
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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