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