This topic is now archived and is closed to further replies.


This topic is 5978 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I use the following code to do a blit operation in GDI but it won''t blit anything.
HDC WindowDC = GetDC(hwnd);
HDC TempDC = CreateCompatibleDC(NULL);
HBITMAP bmp = LoadBitmap(hinstance, MAKEINTRESOURCE(ID_BITMAP));
SelectObject(TempDC, bmp);

BitBlt(WindowDC, 0, 0, 640, 480, TempDC, 0, 0, SRCCOPY);

I don''t receive any compile errors, it just won''t blit. Any ideas? Am I forgetting something?

Share this post

Link to post
Share on other sites
I''m assuming you''re releasing the device context for the window after you finish and just didn''t include it in the code, but if you didn''t release it, that would definately cause a problem which might result in BitBlt not working. However, other than that, I see no problems with your code.

Share this post

Link to post
Share on other sites