Capture Windows form paint messages
Posted on 2008-06-20
I have a standard frame on a form with a background drawn via BitBlt. The form is maximised and covers the whole desktop area but the frame is only covering a part of my form. If another application gets the focus (ie the user decides to switch apps) and is moved or resized over the frame, the background portion of the frame where the other application has overlayed it gets redrawn. The redrawn portion is painted with the background colour property colour and not my BitBlt image.
What I want to do is either
a) detect that another app has focus and is redrawn, moved or sized over my app (in particular over my frame but just over my app would be enough); or
b) detect that part of my frame has been redrawn.
Once I have this I will call a redraw of my frame backgound BitBlt to repair the portion redrawn because of the other app.
I do not understand enough about how Windows redraws the portion under an app that is resizing to know how to do this.
Looking for a subclass/hook solution or ideas on which windows message to look for. No timer stuff please.
Thanks in advance