https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f636b96eeedddf3e7e37d…
commit f636b96eeedddf3e7e37d59e2731f74e88cba221
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Dec 16 09:49:43 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Dec 16 09:49:43 2021 +0900
[EXPLORER] Quick taskbar menu even if any halted window (#4165)
Optimized for speed. CORE-17894
---
base/shell/explorer/taskswnd.cpp | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/base/shell/explorer/taskswnd.cpp b/base/shell/explorer/taskswnd.cpp
index d6e6d2a97ac..caa725fc14e 100644
--- a/base/shell/explorer/taskswnd.cpp
+++ b/base/shell/explorer/taskswnd.cpp
@@ -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 (hIcon)
- return hIcon;
+ if (bAlive)
+ {
+ bAlive = GET_ICON(ICON_SMALL);
+ if (hIcon)
+ return hIcon;
+ }
- SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000,
(PDWORD_PTR) &hIcon);
- if (hIcon)
- return hIcon;
+ if (bAlive)
+ {
+ GET_ICON(ICON_BIG);
+ if (hIcon)
+ return hIcon;
+ }
+#undef GET_ICON
- hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICONSM);
+ 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)