Archived

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

Daishim

BitBlit

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);

DeleteObject(TempDC);
  
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
Could somebody take a look at my code if I were to send it, because I cannot figure this out? Something is preventing BitBlt and I can''t figure out what it is.

Share this post


Link to post
Share on other sites
I figured it out, it was the .rc file, it wasn''t including the right .h file. Why this didn''t flag an error, I don''t know.

Share this post


Link to post
Share on other sites