# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1334596579 0 # Node ID 28775ce2d26ca2082b18d3a42334e73144532133 # Parent d06255e46ce2296a84125503ca2d8306fa96feaf Okay second attempt at that Windows 7 icon/bitmap fix... Last fix broke auto-sizing using HBITMAPS... this one seems to work for both HBITMAP and HICON but need to test on XP. diff -r d06255e46ce2 -r 28775ce2d26c win/dw.c --- a/win/dw.c Mon Apr 16 17:01:49 2012 +0000 +++ b/win/dw.c Mon Apr 16 17:16:19 2012 +0000 @@ -4562,20 +4562,14 @@ dw_free(buf); } - /* Attempt to get bitmap from classes that can have them */ + /* Attempt to get icon from classes that can have them */ if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) - { - if(!(hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0))) - hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); - } - if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) - { - if(!(hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0))) - hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); - } + hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0); + else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) + hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0); /* If we got an icon, pull out the internal bitmap */ - if(hic && !hbm) + if(hic) { ICONINFO ii; @@ -4583,6 +4577,16 @@ hbm = ii.hbmMask ? ii.hbmMask : ii.hbmColor; } + /* If we weren't able to get the bitmap from the icon... */ + if(!hbm) + { + /* Attempt to get bitmap from classes that can have them */ + if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) + hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); + else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) + hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); + } + /* If we got an image... set the sizes appropriately */ if(hbm) {