title: What is, and why do I have to restore bitmap hdc or memory dc to the default state when cleaning up?
body: <p>When I was looking at BitBlt() examples, I noticed almost all of them were saving the default state of the hdc for bitmaps and then restoring the hdc to the default state using SelectObject() at clean up. Including the source code for Nethack for windows.</p>
  <p>Except one of them which wasn't doing that and just cleaning up hdc and bitmaps like how I was doing. I don't see how restoring the hdc to the default state has got something to do with memory leak. Isn't just deleting the hdc enough? Does the hdc loads data or something when you SelectObject() it to a bitmap that you have to restore it to clean it up?</p>