MFC Dynamic Text Control?

What MFC control should I use and how to use it to display constantly changing text (for example, execution text) in a dialog box?

For example, should you use a static text control? But can you change it programmatically?

+4
source share
1 answer

Yes, you can programmatically change the contents of a static control. Change the identifier to something other than IDC_STATIC , then you can assign it a member variable. You can set the text using your_var.SetWindowText() .

Edit: how many changes do you make and how fast? I made a quick test program with a timer (set to a duration of 0) that formats and writes a new line to the control when the time is triggered, so it is constantly updated. Here's what it looks like after starting for a while:

Test program

And this is what the Task Manager shows:

Task manager

The spike on the right (at least basically) is the selection of a screenshot of the save program, etc. As soon as I stopped doing such things, the CPU usage returned to the noise level (with a random burst). I left the program running - after half an hour or later, it still succeeds without noticeable CPU usage (quickly, according to the Task Manager, it had not yet used another second of processor time).

+3
source

Source: https://habr.com/ru/post/1302448/


All Articles