This isn't an easy question to answer, because it depends on how your application is structured. Fundamentally, you need to minimize the amount of painting you do. If you implement a WM_PAINT handler to paint the dialog's surface yourself, you should look into the GetUpdateRect or GetUpdateRgn functions to determine the area of the surface which actually needs to be repainted, and only perform painting operations that affect this area. (Windows clips painting to this area anyway, so any painting operations which go outside this area simply waste time). You can find out whether a rectangle will be drawn using the RectVisible function. Alternatively, use IntersectRect to find out if any part of one rectangle is within another (and the area that is within both), RectInRegion to find out if any part of a rectangle is in that region, or PtInRect and PtInRegion to check whether a point is in the rectangle or region. If doing your own painting, it may be better to do as much painting as possible with one set of graphics objects rather than constantly swapping between different objects (for example, if you want two black lines and a red line, select a black pen, draw the two black lines, then select a red pen and draw the red line, rather than drawing the red line in between the two black ones). If you're overpainting the entire background of the window, consider implementing a handler for WM_ERASEBKGND and returning TRUE. This prevents some flicker generated by Windows painting the window background with the default background brush, then your painting code painting the actual desired result over the top. If you're not doing your own painting, consider reducing the number of controls on your dialog. When Windows has an invalid region on the screen, it has to generate a WM_PAINT for every window that intersects the invalid region. The overhead can cause the overall painting operation to take a long time. You should ensure that any controls that aren't visible because another control is obscuring them are actually hidden (call ShowWindow with the SW_HIDE flag). If these are controls that are part of the dialog template, hide any controls not initially active in the template.
Stability. What an interesting concept. -- Chris Maunder