Reputation: 4903
My classmates started using Delphi with pascal but I as c++ porgrammer have to use win32 API. They were changing background color so I need to know this aswell but there are some differencies.
In delphi each form looks like it has it's own instance, and setting background color for one window is just a matter of changing one value. Not the case with win32 where when you change that value it affects every window using that class (after update ofc).
What I need to do is to clear/erase my window background. I can do that with FillRect(..) and it's working very nicely, but I've found also WM_ERASEBKGND which seems to be doing exactly what I need. They mentioned that if this message gets proccessed I should return a non-zero, but they didn't tell how to process it.
So could anything else then FillRect(and similliar) let me erase a window with a brush I defined and not with the default for class?
Thanks
Upvotes: 4
Views: 8341
Reputation: 41
If you're using MFC with C++ you can also check out that framework's implementation of CWnd::OnEraseBkgnd http://msdn.microsoft.com/en-us/library/a0a52fkz(v=vs.80).aspx
Upvotes: 1
Reputation: 67175
You process WM_ERASEBKGND
simply by erasing the background (using FillRect()
is fine).
By returning a non-zero value, you are simply telling Windows that this message has been taken care of and no further action is needed. There is nothing more formal than that.
Upvotes: 13