What MFC control should I use and how should I use it to display constantly changing text (like progress text) on a dialog?
For example, should I use the static text control? But can you change it programmatically?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can change the contents of a static control programmatically. Change the ID to something other than
IDC_STATIC, then you can assign a member variable to it. You can set the text withyour_var.SetWindowText().Edit: how many changes are you making, and how fast? I did a quick test program with a timer (set to a duration of 0) that formats and writes a new string to the control when the time fires, so it’s updating constantly. Here’s what it looks like after running for a while:
And here’s what Task Manager shows:
The spike a the right is (at least mostly) from taking the screen shot of the test program saving it, and so on. As soon as I quit doing things like that, CPU usage went back to do noise level (with the occasional blip). I left the program running — a half hour or so later, it’s still doing fine, with no noticeable CPU usage (in fast according to Task Manager, it hasn’t used even one second of CPU time yet).