Sounds strange if you've not encountered the flicker problem in other contexts, but that's typically how it's done.
In typical situations like dialogs, we usually have child controls which are themselves windows, and tell the parent window to "clip children" by setting that style at the parent window's creation. In that way the parent's background painting clips the children such that they aren't overpainted (flickered).
Another scenario comes to play when blitting the entire window surface, like a hidden buffer painting scheme or when the entire client area of the window is displayed from a bitmap or series of bitmaps, such as a video player. In this case we assume the entire window will be covered by the blit of the bitmap, and so there's no need to even erase the background - none of it would ever be visible once the bitmap is blitted into position.
You can choose to set the background brush to NULL at the window creation and/or override the erase background message response function and do nothing (stopping the background painting).
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).