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

x
?
Solved

Change Text of a CText Static

Posted on 2003-02-24
2
Medium Priority
?
226 Views
Last Modified: 2013-11-20
I have several CText static text areas on a dialog in my application.  I'm trying to change the text contained within them when certain events occur.  Specifically, I'm trying to print the name of the file opened to the static text control.  I have all the code in place to give me the filename from CFileDialog, but cannot implement the change to the static text controls.  I previously did this with edit boxes, but I would like to convert to static texts for a more polished look.  I was thinking along the lines of getting a pointer to the control and using *ptr->SetWindowText(str_Text) but was unable to do it.  I would appreciate any help offered.  Thanks in advance.
0
Comment
Question by:klax33
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 400 total points
ID: 8008770
1) Change the ID of the static control from the default IDC_STATIC (which is shared among all static controls) to something unique.

2) In your code, you can use the CWnd member function SetDlgItemText(IDC_STATIC_ID, "New Text");
0
 

Author Comment

by:klax33
ID: 8008982
Exactly what I needed.  Thanks for the quick and correct response jhance.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

571 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