News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Double Buffering

Started by Bieb, March 19, 2005, 10:36:19 PM

Previous topic - Next topic

raymond

QuoteI know that the buffer is being copied on to the static control, because if  adjust the destination coordinates of BitBlt, it causes it to only draw on part of the static control, and part remains transparent.

That was a most important observation. It means that the BitBlt function was used. AND IT WAS THUS USED AS SPECIFIED.

Invoke BitBlt, StaticHDC, 0, 0, StaticRect.right, StaticRect.bottom, BufferHandle, 0, 0, 42H

;Invoke BitBlt, StaticHDC, 0, 0, 428, 432, BufferHandle, 0, 0, 42H

The last parameter for the function must be the "raster-operation code". If that 42h you used was inserted there by Easy Code, I'll never even think of using it. That 42h is the code for BLACKNESS, described as:

Fills the destination rectangle using the color associated with index 0 in the physical palette. (This color is black for the default physical palette.)

Try using the code for SRCCOPY instead.

Raymond

P.S. Don't forget to release handles and delete objects (such as your bitmap) when you process the WM_CLOSE message.
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Ramon Sala

Hi,

As raymond said, the DC handle to be passed to CreateCompatibleBitmap function must be the screen DC or the Static1 control DC, not the handle of the created compatible DC. On the other hand, the last parameter passed to BitBlt function should be SRCCOPY (42H is BLACKNESS). After those two changes, the program will work fine.

Ramon
Greetings from Catalonia

Bieb

Wow, I feel like a real idiot.  For some reason, I thought that 42H was the value for SRCCOPY.  It works now.  Thanks a lot for the help, everyone.

Ramon Sala

Hi Bieb,

To avoid those errors, the best you can do is using always the Windows constants (SRCCOPY, SRCPAINT, etc.).

Ramon
Greetings from Catalonia