Erase win32API background window

My classmates started using Delphi with pascal, but I, like C ++ porgrammer, should use the win32 API. They changed the background color, so I need to know this, but there are some differences.

In delphi, each form looks like it has its own instance, and setting the background background for one window is just a matter of changing one value. Not in the case of win32, where when you change this value, it affects every window using this class (after updating c).

I need to do to clear / erase the background of my window. I can do this with FillRect (..) and it works very well, but I also found WM_ERASEBKGND , which seems to do exactly what I need. They mentioned that if this message succeeds, I must return a non-zero value, but they did not say how to handle it.

So can anything else, then FillRect (and similliar) allow me to erase the window with the brush that I defined, and not the default for the class?

thank

+3
source share
2 answers

You are processing WM_ERASEBKGNDsimply by erasing the background (using FillRect()fine).

, Windows, , . , .

+11

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