Could someone point me to a reference for how a parent window and it's child work together to paint themselves? My specific problem is I have a general window type child with a rebar type as it's parent. I've caught the NM_CUSTOMDRAW message to do custom painting, I need draw on both the rebar and the child. After THAT, I also need the mouse messages that normally stop in the child to propagate up to the parent rebar. Any ideas? Tuts I should read? Help?
From my knowledge of Parent/Child 'repaints', it seems to me that, when an InvalidateRect/InvalidateRgn is used, Windows checks to see if there are any windows in the rectangle or region in question. If there are, Windows also sends a WM_PAINT notification to the child window. So, if you want to update both windows, it's probably best to either mask out only the child window, or invalidate the whole thing (depending on your needs). However, if your problem refers to a floating window or something that is technically a child window, but not attached, you will probably have to catch the parent WM_PAINT message. Then invalidate or send a user defined message to the child window.
If you're setting it up to where the child redraws itself before the parent, then the child window merely needs to tell the parent to redraw itself. You can use InvalidateRect to allow coalescing of WM_PAINT requests, or you can request an immediate redraw with RedrawWindow. When a overlying window is removed, Windows will invalidate the areas that were "uncovered", forcing a WM_PAINT message to all windows that are affected.
Thanks for the replies, I seem to have stumbled myself onto a method that works. I need to paint the CHILD as the parent is painted. This is a problem because the children are painted AFTER the parent, and normally, the child is outside the parent's clip region. I got this to work by doing the following: 1) Changed the parent's style to delete any WS_CLIPCHILDREN or WS_CLIPSIBLINGS styles. 2) in the Child's WInProc, I ate the WM_ERASEBKGND message (returned 1). This prevents an automatic paint of the child in the back color. Rebars are a bit weird in that they provide a notification message that PAINT either will happen, or just happened. It's not the WM_PAINT event pre-say (ie, no PAINTSTRUCT) So... in that message, with the background painting disabled, and no clipping of the child window, I was able to draw directly on the child. Ugh.