|
3 | 3 | #include "ConfigFile.h" |
4 | 4 | #include "resource.h" |
5 | 5 | #include "WcharMbcsConverter.h" |
| 6 | +#include "Utility.h" |
6 | 7 |
|
7 | 8 | ConfigFile* ConfigFile::s_instance; |
8 | 9 |
|
@@ -58,7 +59,7 @@ void ConfigFile::readConfig() |
58 | 59 | char buffer[500]; |
59 | 60 |
|
60 | 61 |
|
61 | | - HBITMAP hIcon; |
| 62 | + HBITMAP hBitmap; |
62 | 63 |
|
63 | 64 | while (startupFile.good()) |
64 | 65 | { |
@@ -90,17 +91,20 @@ void ConfigFile::readConfig() |
90 | 91 | char *iconPath = strtok_s(NULL, "/", &context); |
91 | 92 | if (!iconPath || !(*iconPath)) |
92 | 93 | { |
93 | | - hIcon = static_cast<HBITMAP>(LoadImage(m_hInst, MAKEINTRESOURCE(IDB_PYTHON), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)); |
| 94 | + hBitmap = static_cast<HBITMAP>(LoadImage(m_hInst, MAKEINTRESOURCE(IDB_PYTHON), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)); |
94 | 95 | iconPath = NULL; |
95 | 96 | } |
96 | 97 | else |
97 | 98 | { |
98 | 99 | iconFullPath = expandPathIfNeeded(iconPath); |
99 | | - hIcon = static_cast<HBITMAP>(LoadImage(NULL, iconFullPath.c_str(), IMAGE_BITMAP, 16, 16, LR_LOADMAP3DCOLORS | LR_LOADFROMFILE)); |
| 100 | + hBitmap = static_cast<HBITMAP>(LoadImage(NULL, iconFullPath.c_str(), IMAGE_BITMAP, 16, 16, LR_LOADMAP3DCOLORS | LR_LOADFROMFILE)); |
| 101 | + if (hBitmap == NULL) { |
| 102 | + hBitmap = ConvertIconToBitmap(const_cast<LPWSTR>(iconFullPath.c_str())); |
| 103 | + } |
100 | 104 | } |
101 | 105 | if (scriptFullPath != L"") |
102 | 106 | { |
103 | | - m_toolbarItems.push_back(std::pair<tstring, std::pair<HBITMAP, tstring> >(scriptFullPath, std::pair<HBITMAP, tstring>(hIcon, iconPath ? iconFullPath : tstring()))); |
| 107 | + m_toolbarItems.push_back(std::pair<tstring, std::pair<HBITMAP, tstring> >(scriptFullPath, std::pair<HBITMAP, tstring>(hBitmap, iconPath ? iconFullPath : tstring()))); |
104 | 108 | } |
105 | 109 | } |
106 | 110 | else if (0 == strcmp(element, "SETTING")) |
|
0 commit comments