Randolph Levant
Randolph Levant

Reputation: 229

Oh, no! My text is flickering?

Basically, I'm trying to create an application that features a bunch of colored rectangles with text written on them that you can click, making it doing stuff. It runs pretty well, except for the fact that the text on each of the buttons (Created using DrawText()) is constantly flickering. Is there anything I can do to potentially fix this problem?

Upvotes: 2

Views: 1255

Answers (1)

David Heffernan
David Heffernan

Reputation: 612964

From your comment above, you describe calling the draw procedure of your application object form your main message loop. This is almost certainly the source of your problem. Not only will it lead to flickering, it sounds like you are running your application at 100% CPU utilization which is not good.

What you should do is handle the WM_PAINT message and only paint in response to that message. That is how Windows GUI apps are meant to work. I recommend you read up in any introductory Windows GUI book. The canonical such book is Petzold's Programming Windows.

Upvotes: 6

Related Questions