Author: hbelusca
Date: Sun Aug 24 16:58:39 2014
New Revision: 63941
URL:
http://svn.reactos.org/svn/reactos?rev=63941&view=rev
Log:
[TASKMGR]: Clarify the icon handle retrieval, getting rid also of that xhIcon variable.
CORE-8148 #resolve #comment The original code was ok, but was not very clear.
Modified:
trunk/reactos/base/applications/taskmgr/applpage.c
Modified: trunk/reactos/base/applications/taskmgr/applpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] Sun Aug 24 16:58:39
2014
@@ -332,11 +332,9 @@
WCHAR szText[260];
BOOL bLargeIcon;
BOOL bHung = FALSE;
- HICON* xhIcon = (HICON*)&hIcon;
typedef int (FAR __stdcall *IsHungAppWindowProc)(HWND);
IsHungAppWindowProc IsHungAppWindow;
-
/* Skip our window */
if (hWnd == hMainWnd)
@@ -357,20 +355,21 @@
}
noApps = FALSE;
+
/* Get the icon for this window */
hIcon = NULL;
- SendMessageTimeoutW(hWnd, WM_GETICON,bLargeIcon ? ICON_BIG /*1*/ : ICON_SMALL /*0*/,
0, 0, 1000, (PDWORD_PTR)xhIcon);
-
+ SendMessageTimeoutW(hWnd, WM_GETICON, bLargeIcon ? ICON_BIG : ICON_SMALL, 0, 0, 1000,
(PDWORD_PTR)&hIcon);
if (!hIcon)
{
+ /* We failed, try to retrieve other icons... */
hIcon = (HICON)(LONG_PTR)GetClassLongPtrW(hWnd, bLargeIcon ? GCL_HICON :
GCL_HICONSM);
if (!hIcon) hIcon = (HICON)(LONG_PTR)GetClassLongPtrW(hWnd, bLargeIcon ?
GCL_HICONSM : GCL_HICON);
- if (!hIcon) SendMessageTimeoutW(hWnd, WM_QUERYDRAGICON, 0, 0, 0, 1000,
(PDWORD_PTR)xhIcon);
- if (!hIcon) SendMessageTimeoutW(hWnd, WM_GETICON, bLargeIcon ? ICON_SMALL /*0*/ :
ICON_BIG /*1*/, 0, 0, 1000, (PDWORD_PTR)xhIcon);
- }
-
- if (!hIcon)
- hIcon = LoadIconW(hInst, bLargeIcon ? MAKEINTRESOURCEW(IDI_WINDOW) :
MAKEINTRESOURCEW(IDI_WINDOWSM));
+ if (!hIcon) SendMessageTimeoutW(hWnd, WM_QUERYDRAGICON, 0, 0, 0, 1000,
(PDWORD_PTR)&hIcon);
+ if (!hIcon) SendMessageTimeoutW(hWnd, WM_GETICON, bLargeIcon ? ICON_SMALL :
ICON_BIG, 0, 0, 1000, (PDWORD_PTR)&hIcon);
+
+ /* If we still do not have any icon, load the default one */
+ if (!hIcon) hIcon = LoadIconW(hInst, bLargeIcon ? MAKEINTRESOURCEW(IDI_WINDOW) :
MAKEINTRESOURCEW(IDI_WINDOWSM));
+ }
bHung = FALSE;