Need help copying and painting with BitBlt

James Hawkins truiken at
Sat Sep 24 00:17:56 CDT 2005

Hey guys,

I'm working on implementing the SizeBar in HTML Help, but I'm running
into troubles with BitBlt.  The expected behavior is as follows:

* User left-clicks on the SizeBar window. WM_LBUTTONDOWN
  - Copy the contents of the SizeBar window to a bitmap.
* User "drags" the SizeBar left or right. WM_MOUSEMOVE
  - Draw the bitmap containing the SizeBar contents with
    XOR so the old position is erased and the new position is drawn.
* User releases the SizeBar. WM_LBUTTONUP
  - Release bitmap resources.
  - Resize internal windows.

The only thing not working is the color of the moving SizeBar.  The
color in the bar is black with very few specks of white here and
there.  Also, when the bar passes over text, the parts of the bar with
text under it turns white.  Another problem is that the bar is drawn
23 pixels too high, so the bar starts at y=26 even though I specify
y=49 in BitBlt.  Right now I'm using a couple global variables
temporarily until I can get the feature to work, but the following is
the function that copies the bits from the SizeBar window into the

static void SB_CopySizeBar(HHInfo *pHHInfo)
    HDC hdc = GetDC(pHHInfo->hwndSizeBar);
    RECT rc;

    hdcMem = CreateCompatibleDC(hdc);

    SB_GetSizeBarRect(pHHInfo, &rc);
    hbm = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);

    SelectObject(hdcMem, hbm);
    BitBlt(hdcMem, rc.left,, rc.right, rc.bottom, hdc, 0, 0, SRCCOPY);

When I paint the bar I use:

BitBlt(hdc, rc.left,, rc.right, rc.bottom, hdcMem, 0, 0, SRCINVERT);

I've attached a screen shot of what it should look like, and what it
actually looks like.  If anyone has any ideas about getting this to
work, I would greatly appreciate it.

James Hawkins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: native.jpeg
Type: image/jpeg
Size: 9492 bytes
Desc: not available
Url :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: builtin.jpeg
Type: image/jpeg
Size: 13921 bytes
Desc: not available
Url :

More information about the wine-devel mailing list