[MSGINA] gui: Improve DlgData_LoadBitmaps() (#2520)

And let bar timer depend on the bar image only.

Addendum to 623dd26cce.
This commit is contained in:
Serge Gautherie 2020-06-01 11:26:53 +02:00 committed by GitHub
parent 6baa151888
commit 64fea1dbd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}