BitBlt question

Started by
4 comments, last by scorpion007 16 years, 4 months ago
Have a simple question, can I only use BitBlt() within the WM_PAINT message? As it only seems to draw a black window if I try and use it outside of that. I have tried doing this in a seperate function: BitBlt from a loaded bmp in a memory DC to my primary memory dc. then under WMPAINT I blit from that primary memory dc to the screen but only get a black window. If I instead do the same thing in the WMPAINT block, it works fine.
Advertisement
Could you post your code for when you place it out of WM_PAINT?
  while(true)  {    if(PeekMessage(&msg,NULL,0,0, PM_REMOVE))    {      if(msg.message == WM_QUIT)        break;      TranslateMessage(&msg);      DispatchMessage(&msg);    }         BitBlt(hdcmem, 0, 0, 200, 200, bmp[HBMT54].GethDC(), 0, 0, SRCCOPY);


If I put the same line of code in a WM_PAINT it works. hdcmem is initialised prior to entering the message loop.
Did you check the return value to see if there was an error?
You guys basically answered my question in that you CAN use BitBlt outside of WM_PAINT.

I figured it out now. I was releasing the screen DC too soon.

thanks!


[Edited by - wind_addict on November 22, 2007 6:03:41 PM]
Did you call GetLastError for extended error information? Then use the Error Lookup utility from the PSDK to map it to a text description.

This topic is closed to new replies.

Advertisement