Commit 8688677 1 parent 58830b7 commit 8688677 Copy full SHA for 8688677
File tree 1 file changed +16
-9
lines changed
1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change 1
1
#include " Skin.h"
2
2
3
3
#include < algorithm>
4
+ #include < CommCtrl.h>
4
5
#include < memory>
5
6
#include < vector>
6
7
#include < Shlwapi.h>
7
8
9
+ #include " CommCtl.h"
8
10
#include " Error.h"
9
11
#include " MeterWnd/Meters/MeterTypes.h"
10
12
#include " StringUtils.h"
@@ -170,20 +172,25 @@ std::vector<HICON> Skin::Iconset(char *osdName) {
170
172
continue ;
171
173
}
172
174
173
- QCLOG ( L" %s " , ( iconDir + iconName). c_str ()) ;
174
- Gdiplus::Bitmap *iconBmp = Gdiplus::Bitmap::FromFile (
175
- (iconDir + iconName). c_str ());
176
- if (iconBmp == NULL ) {
177
- CLOG ( L" Failed to load icon! " ) ;
175
+ std::wstring iconPath = iconDir + iconName;
176
+ std::wstring ext = StringUtils::FileExtension (iconName);
177
+ if (ext != L" ico " ) {
178
+ QCLOG ( L" Ignoring non-ico file: %s " , iconPath. c_str ());
179
+ continue ;
178
180
}
179
181
180
- HICON icon;
181
- if (iconBmp->GetHICON (&icon) == Gdiplus::Status::Ok) {
182
+ HICON icon = NULL ;
183
+ HRESULT hr = LoadIconMetric (
184
+ NULL ,
185
+ iconPath.c_str (),
186
+ LIM_SMALL,
187
+ &icon);
188
+
189
+ if (icon != NULL ) {
190
+ QCLOG (L" %s" , iconPath.c_str ());
182
191
iconset.push_back (icon);
183
192
}
184
193
185
- delete iconBmp;
186
-
187
194
} while (FindNextFile (hFind, &fd));
188
195
FindClose (hFind);
189
196
You can’t perform that action at this time.
0 commit comments