I am trying to dynamically change the text of a CStatic
control. My member variable is called mStatic
of the type CStatic
. I have changed the ID to IDC_MYSTATIC
instead of IDC_STATIC
.
I am calling mStatic.SetWindowText("asdfasdf")
when I want to change the text of the control. I do this periodically in a timer.
Now I have the problem that the previous text is not erased after I call the SetWindowText()
. It just keeps piling up until I get a mess on the screen.
The parent window has the layered property with a bitmap background. I have also set the color_key property so a certain color of the bitmap is viewed as transparent (I.e. It will not be drawn and will let mouse messages through). The mStatic control is drawn on the parts not transparent, that have a bitmap background.
Why isn't the window invalidating?
This knowledge base support article describes the same problem when the
SetWindowText()
call is made from another thread. Is that what your timer is doing?If so the solution could simply be to: