Hi - quick couple of questions regarding drawing bitmaps...
1. MSDN says.. "After painting with a common DC, the ReleaseDC function must be called to release the DC. " - Does this mean it must absolutely be released within the one WM_PAINT message? In otherwords, it is not OK to keep the DC around until the end of the program?
2. In the following code I want to draw two bitmaps, I can see a number of problems with the code below, i.e. I am not reinstating the old bitmap. How do I go about rewriting this properly - so I can draw both images in the window without causing any resource leaks?
dc = BeginPaint(hwnd, &ps);
dcMem = CreateCompatibleDC(NULL);
BitBlt(dc, 0, 200, 140, 160, dcMem, 0, 0, SRCCOPY);
BitBlt(dc, 0, 0, 400, 160, dcMem, 0, 0, SRCCOPY);