Sign in to follow this  
wind_addict

BitBlt question

Recommended Posts

wind_addict    122
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.

Share this post


Link to post
Share on other sites
wind_addict    122


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.

Share this post


Link to post
Share on other sites
wind_addict    122
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]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this