Skip to content

Commit 237176f

Browse files
committed
Fix 100% download progress bar remains issue
and make the dialog appearing after as modal dialog of Notepad++. ref: 069edc2#commitcomment-143134592
1 parent 3beed29 commit 237176f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/winmain.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static size_t setProgress(HWND, double dlTotal, double dlSoFar, double, double)
538538

539539
if (dlTotal != 0)
540540
{
541-
size_t step = size_t(dlSoFar * 100.0 / dlTotal - downloadedRatio);
541+
size_t step = size_t((dlSoFar * 100.0 / dlTotal) - downloadedRatio);
542542

543543
SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)step, 0);
544544
SendMessage(hProgressBar, PBM_STEPIT, 0, 0);
@@ -548,6 +548,10 @@ static size_t setProgress(HWND, double dlTotal, double dlSoFar, double, double)
548548
wchar_t percentage[percentageLen];
549549
swprintf(percentage, percentageLen, L"Downloading %s: %Iu %%", dlFileName.c_str(), downloadedRatio);
550550
::SetWindowText(hProgressDlg, percentage);
551+
552+
if (downloadedRatio == 100)
553+
SendMessage(hProgressDlg, WM_COMMAND, IDOK, 0);
554+
551555
return 0;
552556
};
553557

@@ -584,6 +588,7 @@ LRESULT CALLBACK progressBarDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARA
584588
case IDOK:
585589
EndDialog(hWndDlg, 0);
586590
return TRUE;
591+
587592
case IDCANCEL:
588593
stopDL = true;
589594
if (abortOrNot == L"")
@@ -967,7 +972,7 @@ bool runInstaller(const wstring& app2runPath, const wstring& binWindowsClassName
967972

968973
if (h)
969974
{
970-
int installAnswer = ::MessageBox(NULL, closeMsg.c_str(), closeMsgTitle.c_str(), MB_YESNO);
975+
int installAnswer = ::MessageBox(h, closeMsg.c_str(), closeMsgTitle.c_str(), MB_YESNO | MB_APPLMODAL);
971976

972977
if (installAnswer == IDNO)
973978
{

0 commit comments

Comments
 (0)