https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a84d295974429fa59039346c33f81455f3da87e8

commit a84d295974429fa59039346c33f81455f3da87e8
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Wed Dec 29 01:23:10 2021 +0100
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Wed Dec 29 01:28:56 2021 +0100

    [RAPPS] Fix the download dialog not having an icon when RAPPS is started 
for the first time and the database is downloaded beforehand.
---
 base/applications/rapps/loaddlg.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/base/applications/rapps/loaddlg.cpp 
b/base/applications/rapps/loaddlg.cpp
index d86bdda5131..fbe85205b19 100644
--- a/base/applications/rapps/loaddlg.cpp
+++ b/base/applications/rapps/loaddlg.cpp
@@ -406,16 +406,23 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND 
Dlg, UINT uMsg, WPARAM w
 
         bCancelled = FALSE;
 
-        hIconBg = (HICON) GetClassLongPtrW(hMainWnd, GCLP_HICON);
-        hIconSm = (HICON) GetClassLongPtrW(hMainWnd, GCLP_HICONSM);
+        if (hMainWnd)
+        {
+            hIconBg = (HICON)GetClassLongPtrW(hMainWnd, GCLP_HICON);
+            hIconSm = (HICON)GetClassLongPtrW(hMainWnd, GCLP_HICONSM);
+        }
+        if (!hMainWnd || (!hIconBg || !hIconSm))
+        {
+            /* Load the default icon */
+            hIconBg = hIconSm = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
+        }
 
         if (hIconBg && hIconSm)
         {
-            SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) hIconBg);
-            SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSm);
+            SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
+            SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
         }
 
-        SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0);
         HWND Item = GetDlgItem(Dlg, IDC_DOWNLOAD_PROGRESS);
         if (Item)
         {
@@ -448,7 +455,6 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND 
Dlg, UINT uMsg, WPARAM w
         DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, 
szCaption);
         unsigned int ThreadId;
         HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *) 
param, 0, &ThreadId);
-
         if (!Thread)
         {
             return FALSE;

Reply via email to