UINT uiPercentage = ((ULONGLONG) ulProgress * 100) / ulProgressMax;
/* send the current progress to the progress bar */
+ if (!IsWindow()) return;
SendMessage(PBM_SETPOS, uiPercentage, 0);
/* format total download size */
else
{
/* send the current progress to the progress bar */
+ if (!IsWindow()) return;
SendMessage(PBM_SETPOS, 0, 0);
/* total size is not known, display only current size */
}
/* and finally display it */
+ if (!IsWindow()) return;
SendMessage(WM_SETTEXT, 0, (LPARAM) ProgressText.GetString());
}
{
HWND Item;
+ if (!IsWindow(hDlg)) return;
ProgressBar.SetProgress(ulProgress, ulProgressMax);
+ if (!IsWindow(hDlg)) return;
Item = GetDlgItem(hDlg, IDC_DOWNLOAD_STATUS);
if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
{
for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
{
// Reset progress bar
+ if (!IsWindow(hDlg)) break;
Item = GetDlgItem(hDlg, IDC_DOWNLOAD_PROGRESS);
if (Item)
{
szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
}
+ if (!IsWindow(hDlg)) goto end;
SetWindowTextW(hDlg, szNewCaption.GetString());
// build the path for the download
}
// Add the download URL
+ if (!IsWindow(hDlg)) goto end;
SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_DOWNLOADING);
}
dwCurrentBytesRead += dwBytesRead;
+ if (!IsWindow(hDlg)) goto end;
UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
} while (dwBytesRead && !bCancelled);
ProgressBar.SetMarquee(FALSE);
dwContentLen = dwCurrentBytesRead;
+ if (!IsWindow(hDlg)) goto end;
UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
}
if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
goto end;
+ if (!IsWindow(hDlg)) goto end;
SetWindowTextW(hDlg, szMsgText.GetString());
SendMessageW(GetDlgItem(hDlg, IDC_DOWNLOAD_STATUS), WM_SETTEXT, 0, (LPARAM) Path.GetString());
if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
goto end;
+ if (!IsWindow(hDlg)) goto end;
MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
goto end;
}
//reflect installation progress in the titlebar
//TODO: make a separate string with a placeholder to include app name?
ATL::CStringW szMsgText = LoadStatusString(DLSTATUS_INSTALLING);
+ if (!IsWindow(hDlg)) goto end;
SetWindowTextW(hDlg, szMsgText.GetString());
DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_INSTALLING);
DeleteFileW(Path.GetString());
}
+ if (!IsWindow(hDlg)) return 0;
DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_FINISHED);
}
delete static_cast<DownloadParam*>(param);
+ if (!IsWindow(hDlg)) return 0;
SendMessageW(hDlg, WM_CLOSE, 0, 0);
return 0;
}