From 435861fa49f5c14cb0129ba6a15730e3c3ae4964 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Thu, 18 Aug 2016 23:06:48 -0300 Subject: [PATCH] Change sub__icon to load the proper embedded icon according to size. Title bar icons are 16x16; 32x32 version is loaded as default. --- internal/c/libqb.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index 71e31c56a..4f1469bdc 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -22376,14 +22376,20 @@ int32 func__printwidth(qbs* text, int32 screenhandle, int32 passed){ while (!window_handle){Sleep(100);} static HANDLE ExeIcon; + static HANDLE ExeIcon16; //Attempt to load the first icon embedded in the .exe if (!ExeIcon) ExeIcon = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON,32, 32, 0); + if (!ExeIcon16) ExeIcon16 = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(0), IMAGE_ICON,16, 16, 0); - //If we have an embedded icon, we'll use it instead of QB64's default - if (!(passed&1) && (ExeIcon)) { - SendMessage( window_handle, WM_SETICON, ICON_SMALL, (LPARAM)ExeIcon ); - SendMessage( window_handle, WM_SETICON, ICON_BIG, (LPARAM)ExeIcon ); + //If we have an embedded icon, we'll use it instead of QB64's default + if (!(passed&1) && (ExeIcon)) { + SendMessage( window_handle, WM_SETICON, ICON_BIG, (LPARAM)ExeIcon ); + + if (ExeIcon16) { + SendMessage( window_handle, WM_SETICON, ICON_SMALL, (LPARAM)ExeIcon16 ); } + else { + SendMessage( window_handle, WM_SETICON, ICON_SMALL, (LPARAM)ExeIcon ); } return; } for (ii=1;ii<=2;ii++){