   Win32 Bitmap Question
  G'day allI'm working on a bitmap class for Win32, and I just have a quick question.  The wrapper currently works, but I need to have the following lines of code:void CreateMemDC(HDC &memDC, HDC &screenDC, UINT x, UINT y){HBITMAP bmp;memDC = CreateCompatibleDC(screenDC);bmp = CreateCompatibleBitmap(screenDC, x, y);SelectObject(memDC, bmp);}Why do I need the variable 'bmp'?  I mean, I select it into the memDC, but its immediately unselected the second I need to display a bitmap with the CBitmap::Draw() function.  What's the purpose of the last two lines?Thanks   
CreateCompatibleBitmap allocates memory in the form of a bitmap. Those docs say that you should call DeleteObject on it when you've finished with it. SelectObject selects the specified object into the specified device context. A device context is a structure that defines a set of graphic objects and their associated attributes, as well as the graphic modes that affect output. Only one kind of each object can be selected at a time for a given device context. So, it's very likely that CBitmap (Is that the MFC class?) selects it's bitmap into the hdc assigned to it. If you want to get at the bits of the bitmap, use CreateDIBSection instead of CreateCompatibleBitmap. Supply a block of memory to that function as the ppvBits argument.   ;  Oi, I can't believe I didn't notice that the bitmap is selected into a different device context.  Wow...  hehThanks!   