How to clear windows in win32?

Hello I am testing something out and am trying to change text on screen..
When the user presses a button it should change the text...

But when I run the TextOut function it just writes over that... I am wondering how to clear the windows. so I can re-write the text.
Call InvalidateRect() from your button press event handler, which will force a WM_PAINT. Take a close look at the parameters of InvalidateRect(). However, if your TextOut() is in your WM_PAINT handler (it should be), that will redraw the line of text. What you would then need to do is place conditional logic in your WM_PAINT handler to specify when text is to be painted, and when it isn't. Its all quite diabolical.
Actually, there are a lot of ways to go about it. You could use DrawText() instead of TextOut(), whose parameter list takes the coordinates of a RECT structure in which painting is to occur. Since you would then have those coordinates where text drawing occurred, you could use one of the rectangle drawing routines to redraw or paint a rectangle over the text. You would need to then obtain a handle to your background brush I believe.
Thank you very much kind sir!
Topic archived. No new replies allowed.