| 94 | //CProgress::SetProgressPercentage() then you should call the version of InitProgress(CWnd *parent) below. |
| 95 | // Returns true if the progress dialog was created |
| 96 | bool CProgress::InitProgress(fix min, fix max, int32_t iterations, CWnd *parent) { |
| 97 | int nmin, nmax, Step; |
| 98 | nmin = FixToInt(min); |
| 99 | nmax = FixToInt(max); |
| 100 | |
| 101 | float delta; |
| 102 | delta = (float)(((float)(nmax - nmin)) / ((float)iterations)); |
| 103 | while (delta < 1.0) { |
| 104 | delta *= 10; |
| 105 | nmax *= 10; |
| 106 | } |
| 107 | Step = (int)delta; |
| 108 | m_Max = nmax; |
| 109 | m_Min = nmin; |
| 110 | |
| 111 | if (!iterations) |
| 112 | return false; |
| 113 | m_StatusDlg = new CStatusDlg; |
| 114 | if (!m_StatusDlg) |
| 115 | return false; |
| 116 | m_StatusDlg->Create(IDD_STATUSDLG, parent); |
| 117 | m_StatusDlg->ShowWindow(SW_SHOW); |
| 118 | m_StatusDlg->Init(nmin, nmax, Step); |
| 119 | return true; |
| 120 | } |
| 121 | |
| 122 | // This is a quick way of initializing the progress indicator, with a range 0-100 step size 1. This is what you |
| 123 | // should call if you plan on using CProgress::SetProgressPercentage(). Again, parent can be NULL if you want it to |