Ok, this is some code that was included in a DirectX utility file thinger:
Code:
HDC                     hdcImage;
//some stuff not involving hdcImage
hdcImage = CreateCompatibleDC(NULL);
//if hdcImage is null, do something
SelectObject(hdcImage, hbm); //hbm is a HBITMAP passed to the function
//some stuff, only involving hdcImage for a StretchBlt()
DeleteDC(hdcImage);
If you select an object into an HDC, aren't you supposed to store the returned object in a temp variable and then select it back in before you delete the HDC? Or does it not matter because hdcImage was created within the function?