BitBlt question
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.
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.
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]
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
Popular Topics
Advertisement