comparison win/dw.c @ 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
comparison
equal deleted inserted replaced
1658:6fe1e91da477 1659:d06255e46ce2
4563 } 4563 }
4564 4564
4565 /* Attempt to get bitmap from classes that can have them */ 4565 /* Attempt to get bitmap from classes that can have them */
4566 if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) 4566 if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0)
4567 { 4567 {
4568 if(!(hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0))) 4568 if(!(hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0)))
4569 hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0); 4569 hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0);
4570 } 4570 }
4571 if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) 4571 if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0)
4572 { 4572 {
4573 if(!(hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0))) 4573 if(!(hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0)))
4574 hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0); 4574 hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0);
4575 } 4575 }
4576 4576
4577 /* If we got an icon, pull out the internal bitmap */ 4577 /* If we got an icon, pull out the internal bitmap */
4578 if(hic && !hbm) 4578 if(hic && !hbm)
4579 { 4579 {