dlls/comctl32/toolbar.c
Ge van Geldorp
gvg at reactos.com
Fri Jan 21 03:01:06 CST 2005
Changelog:
tinus <o112w8r02 at sneakemail.com>
Properly allow removing toolbar bitmaps by changing it into 0
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.205
diff -u -r1.205 toolbar.c
--- dlls/comctl32/toolbar.c 9 Jan 2005 16:42:54 -0000 1.205
+++ dlls/comctl32/toolbar.c 21 Jan 2005 08:59:09 -0000
@@ -4327,31 +4327,34 @@
HBITMAP hOldBitmapBitmap, hOldBitmapLoad, hbmLoad;
HDC hdcImage, hdcBitmap;
- /* copy the bitmap before adding it so that the user's bitmap
- * doesn't get modified.
- */
- GetObjectA (hBitmap, sizeof(BITMAP), (LPVOID)&bmp);
+ /* if there is no new bitmap, just leave */
+ if (NULL != hBitmap)
+ {
+ /* copy the bitmap before adding it so that the user's bitmap
+ * doesn't get modified.
+ */
+ GetObjectA (hBitmap, sizeof(BITMAP), (LPVOID)&bmp);
- hdcImage = CreateCompatibleDC(0);
- hdcBitmap = CreateCompatibleDC(0);
+ hdcImage = CreateCompatibleDC(0);
+ hdcBitmap = CreateCompatibleDC(0);
- /* create new bitmap */
- hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
- hOldBitmapBitmap = SelectObject(hdcBitmap, hBitmap);
- hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
+ /* create new bitmap */
+ hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
+ hOldBitmapBitmap = SelectObject(hdcBitmap, hBitmap);
+ hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
- /* Copy the user's image */
- BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
- hdcBitmap, 0, 0, SRCCOPY);
+ /* Copy the user's image */
+ BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
+ hdcBitmap, 0, 0, SRCCOPY);
- SelectObject (hdcImage, hOldBitmapLoad);
- SelectObject (hdcBitmap, hOldBitmapBitmap);
- DeleteDC (hdcImage);
- DeleteDC (hdcBitmap);
-
- ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace);
- nNewBitmaps = ImageList_GetImageCount(himlDef);
- DeleteObject (hbmLoad);
+ SelectObject (hdcImage, hOldBitmapLoad);
+ SelectObject (hdcBitmap, hOldBitmapBitmap);
+ DeleteDC (hdcImage);
+ DeleteDC (hdcBitmap);
+ ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace);
+ nNewBitmaps = ImageList_GetImageCount(himlDef);
+ DeleteObject (hbmLoad);
+ }
}
infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldBitmaps + nNewBitmaps;
More information about the wine-patches
mailing list