Skip to content

Commit

Permalink
Fix Windows 7 bug where icon doesn't load
Browse files Browse the repository at this point in the history
  • Loading branch information
vanjac committed Aug 25, 2023
1 parent 1dbceb0 commit 179e13f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ItemWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,11 @@ void ItemWindow::IconThread::run() {
SHFILEINFO fileInfo = {};
checkLE(SHGetFileInfo((wchar_t *)(ITEMIDLIST *)itemIDList, 0, &fileInfo, sizeof(fileInfo),
SHGFI_PIDL | SHGFI_ICON | SHGFI_ADDOVERLAYS | SHGFI_SMALLICON));
if (fileInfo.hIcon == nullptr) {
// bug (possibly windows 7 only?) where the first call sometimes fails
checkLE(SHGetFileInfo((wchar_t *)(ITEMIDLIST *)itemIDList, 0, &fileInfo, sizeof(fileInfo),
SHGFI_PIDL | SHGFI_ICON | SHGFI_ADDOVERLAYS | SHGFI_SMALLICON));
}
HICON hIconSmall = fileInfo.hIcon;
checkLE(SHGetFileInfo((wchar_t *)(ITEMIDLIST *)itemIDList, 0, &fileInfo, sizeof(fileInfo),
SHGFI_PIDL | SHGFI_ICON | SHGFI_ADDOVERLAYS | SHGFI_LARGEICON));
Expand Down

0 comments on commit 179e13f

Please sign in to comment.