https://git.reactos.org/?p=reactos.git;a=commitdiff;h=64fea1dbd0fc9cceee1dc…
commit 64fea1dbd0fc9cceee1dc90eb5ac9277a34283e6
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Mon Jun 1 11:26:53 2020 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Jun 1 12:26:53 2020 +0300
[MSGINA] gui: Improve DlgData_LoadBitmaps() (#2520)
And let bar timer depend on the bar image only.
Addendum to 623dd26ccea5e79001aee769c230fb4f8e304fc8.
---
dll/win32/msgina/gui.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c
index 6301a19d955..3cb30bb638f 100644
--- a/dll/win32/msgina/gui.c
+++ b/dll/win32/msgina/gui.c
@@ -56,28 +56,34 @@ DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
return pDlgData;
}
-static BOOL
-DlgData_LoadBitmaps(PDLG_DATA pDlgData)
+static VOID
+DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
{
BITMAP bm;
if (!pDlgData)
- return FALSE;
+ {
+ return;
+ }
pDlgData->hLogoBitmap = LoadImageW(pDlgData->pgContext->hDllInstance,
MAKEINTRESOURCEW(IDI_ROSLOGO), IMAGE_BITMAP,
0, 0, LR_DEFAULTCOLOR);
- GetObject(pDlgData->hLogoBitmap, sizeof(bm), &bm);
- pDlgData->LogoWidth = bm.bmWidth;
- pDlgData->LogoHeight = bm.bmHeight;
+ if (pDlgData->hLogoBitmap)
+ {
+ GetObject(pDlgData->hLogoBitmap, sizeof(bm), &bm);
+ pDlgData->LogoWidth = bm.bmWidth;
+ pDlgData->LogoHeight = bm.bmHeight;
+ }
pDlgData->hBarBitmap = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_BAR),
IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
- GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
- pDlgData->BarWidth = bm.bmWidth;
- pDlgData->BarHeight = bm.bmHeight;
-
- return (pDlgData->hLogoBitmap != NULL && pDlgData->hBarBitmap !=
NULL);
+ if (pDlgData->hBarBitmap)
+ {
+ GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
+ pDlgData->BarWidth = bm.bmWidth;
+ pDlgData->BarHeight = bm.bmHeight;
+ }
}
static void
@@ -192,15 +198,18 @@ StatusDialogProc(
if (pDlgData == NULL)
return FALSE;
- if (DlgData_LoadBitmaps(pDlgData))
+ DlgData_LoadBitmaps(pDlgData);
+ if (pDlgData->hBarBitmap)
{
if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
{
ERR("SetTimer(IDT_BAR) failed: %d\n", GetLastError());
}
-
- /* Get the animation bar control */
- pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
+ else
+ {
+ /* Get the animation bar control */
+ pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
+ }
}
return TRUE;
}