# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1334595709 0 # Node ID d06255e46ce2296a84125503ca2d8306fa96feaf # Parent 6fe1e91da4777a9dceb386f51056792abb1c73a6 Fix auto-sizing bitmap buttons with icons on Windows 7 (and maybe Vista). The buttons will return an invalid HBITMAP on these platforms if you set the button to a HICON... so query the HICON first instead of HBITMAP. diff -r 6fe1e91da477 -r d06255e46ce2 win/dw.c --- a/win/dw.c Mon Apr 16 15:43:43 2012 +0000 +++ b/win/dw.c Mon Apr 16 17:01:49 2012 +0000 @@ -4565,13 +4565,13 @@ /* Attempt to get bitmap from classes that can have them */ if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) { - if(!(hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0))) - hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 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(!(hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0))) - hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0); + if(!(hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0))) + hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); } /* If we got an icon, pull out the internal bitmap */