changeset 1659:d06255e46ce2

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.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 16 Apr 2012 17:01:49 +0000
parents 6fe1e91da477
children 28775ce2d26c
files win/dw.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 */