[EXPLORER] Quick taskbar menu even if any halted window (#4165)

Optimized for speed. CORE-17894
This commit is contained in:
Katayama Hirofumi MZ 2021-12-16 09:49:43 +09:00 committed by GitHub
parent 403222dd4f
commit f636b96eee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -488,27 +488,34 @@ public:
HICON GetWndIcon(HWND hwnd)
{
HICON hIcon = 0;
HICON hIcon = NULL;
#define GET_ICON(type) \
SendMessageTimeout(hwnd, WM_GETICON, (type), 0, SMTO_ABORTIFHUNG, 100, (PDWORD_PTR)&hIcon)
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon);
LRESULT bAlive = GET_ICON(ICON_SMALL2);
if (hIcon)
return hIcon;
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon);
if (bAlive)
{
bAlive = GET_ICON(ICON_SMALL);
if (hIcon)
return hIcon;
}
if (bAlive)
{
GET_ICON(ICON_BIG);
if (hIcon)
return hIcon;
}
#undef GET_ICON
hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM);
if (hIcon)
return hIcon;
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon);
if (hIcon)
return hIcon;
hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICONSM);
if (hIcon)
return hIcon;
hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICON);
return hIcon;
return (HICON)GetClassLongPtr(hwnd, GCL_HICON);
}
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)