src/osd/winui/winui.c
| r8160 | r8161 | |
| 5108 | 5108 | |
| 5109 | 5109 | static DWORD GetShellLargeIconSize(void) |
| 5110 | 5110 | { |
| 5111 | | DWORD dwSize, dwLength = 512, dwType = REG_SZ; |
| 5111 | DWORD dwSize = 32, dwLength = 512, dwType = REG_SZ; |
| 5112 | 5112 | TCHAR szBuffer[512]; |
| 5113 | 5113 | HKEY hKey; |
| 5114 | LONG lRes; |
| 5115 | LPTSTR tErrorMessage = NULL; |
| 5114 | 5116 | |
| 5115 | 5117 | /* Get the Key */ |
| 5116 | | RegOpenKey(HKEY_CURRENT_USER, TEXT("Control Panel\\desktop\\WindowMetrics"), &hKey); |
| 5118 | lRes = RegOpenKey(HKEY_CURRENT_USER, TEXT("Controlanel\\Desktop\\WindowMetrics"), &hKey); |
| 5119 | if( lRes != ERROR_SUCCESS ) |
| 5120 | { |
| 5121 | GetSystemErrorMessage(lRes, &tErrorMessage); |
| 5122 | MessageBox(GetMainWindow(), tErrorMessage, TEXT("Large shell icon size registry access"), MB_OK | MB_ICONERROR); |
| 5123 | LocalFree(tErrorMessage); |
| 5124 | return dwSize; |
| 5125 | } |
| 5126 | |
| 5117 | 5127 | /* Save the last size */ |
| 5118 | | RegQueryValueEx(hKey, TEXT("Shell Icon Size"), NULL, &dwType, (LPBYTE)szBuffer, &dwLength); |
| 5128 | lRes = RegQueryValueEx(hKey, TEXT("Shell Icon Size"), NULL, &dwType, (LPBYTE)szBuffer, &dwLength); |
| 5129 | if( lRes != ERROR_SUCCESS ) |
| 5130 | { |
| 5131 | GetSystemErrorMessage(lRes, &tErrorMessage); |
| 5132 | MessageBox(GetMainWindow(), tErrorMessage, TEXT("Large shell icon size registry query"), MB_OK | MB_ICONERROR); |
| 5133 | LocalFree(tErrorMessage); |
| 5134 | RegCloseKey(hKey); |
| 5135 | return dwSize; |
| 5136 | } |
| 5137 | |
| 5119 | 5138 | dwSize = _ttol(szBuffer); |
| 5120 | 5139 | if (dwSize < 32) |
| 5121 | 5140 | dwSize = 32; |
| r8160 | r8161 | |
| 5149 | 5168 | // create iconlist for Listview control |
| 5150 | 5169 | static void CreateIcons(void) |
| 5151 | 5170 | { |
| 5171 | DWORD dwSmallIconSize = GetShellSmallIconSize(); |
| 5152 | 5172 | DWORD dwLargeIconSize = GetShellLargeIconSize(); |
| 5153 | 5173 | HICON hIcon; |
| 5154 | 5174 | int icon_count; |
| r8160 | r8161 | |
| 5175 | 5195 | dwStyle = GetWindowLong(hwndList,GWL_STYLE); |
| 5176 | 5196 | SetWindowLong(hwndList,GWL_STYLE,(dwStyle & ~LVS_TYPEMASK) | LVS_ICON); |
| 5177 | 5197 | |
| 5178 | | hSmall = ImageList_Create(GetShellSmallIconSize(),GetShellSmallIconSize(), |
| 5198 | hSmall = ImageList_Create(dwSmallIconSize, dwSmallIconSize, |
| 5179 | 5199 | ILC_COLORDDB | ILC_MASK, icon_count, icon_count + grow); |
| 5200 | |
| 5201 | if (NULL == hSmall) { |
| 5202 | win_message_box_utf8(hwndList, "Cannot allocate small icon image list", "Allocation error - Exiting", IDOK); |
| 5203 | PostQuitMessage(0); |
| 5204 | } |
| 5205 | |
| 5180 | 5206 | hLarge = ImageList_Create(dwLargeIconSize, dwLargeIconSize, |
| 5181 | 5207 | ILC_COLORDDB | ILC_MASK, icon_count, icon_count + grow); |
| 5182 | 5208 | |
| 5183 | | if (NULL == hSmall || NULL == hLarge) { |
| 5184 | | win_message_box_utf8(hwndList, "Cannot allocate Icon lists", "Allocation error - Exiting", IDOK); |
| 5209 | if (NULL == hLarge) { |
| 5210 | win_message_box_utf8(hwndList, "Cannot allocate large icon image list", "Allocation error - Exiting", IDOK); |
| 5185 | 5211 | PostQuitMessage(0); |
| 5186 | 5212 | } |
| 5187 | 5213 | |