but how come when i do DeleteDC after GetDC, i can still see all the gfx of the window?
A rough analogy:
You use a DC to paint onto a window like you use a brush to paint onto a canvas.
When you want to begin painting, you ask for a brush - the OS gives you one. Depending on the class style
of the canvas, the brush might be:
brush: one that anyone can pick up and use to paint on any canvas. When you're done with it, give it back to the OS (ReleaseDC) so that it can be cleaned and prepared for the next artist. Destroying (DeleteDC) a common
brush is wasteful, and might get you in trouble. It doesn't belong to you. However, even if you do it, the OS is forgiving enough to give you another brush next time.
brush: only for use with that canvas. In fact, it's tethered to the canvas so you don't even need to give it back to the OS (ReleaseDC) when you're done. However, since the brush won't be cleaned, the next time someone picks it up it might still have your paint on it.
brush: these are deprecated, but I think they're like private
I think in practice, you'll generally get a common
Even if you destroy the brush (DeleteDC), the canvas and paint are still there.
Btw, when MSDN says that you must not
do something, don't do it.
An application must not delete a DC whose handle was obtained by calling the GetDC function.