Added methods to FTProgress class for creating, destroying
and intialization the progress bar controls.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@379 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb_win32/ProgressControl.cxx b/rfb_win32/ProgressControl.cxx
index dd6a79f..1beced0 100644
--- a/rfb_win32/ProgressControl.cxx
+++ b/rfb_win32/ProgressControl.cxx
@@ -45,7 +45,8 @@
m_dw64CurrentValue = position;
m_dw64MaxValue = maxValue;
- SendMessage(m_hwndProgress, PBM_SETRANGE, (WPARAM) 0, MAKELPARAM(0, MAX_RANGE));
+ if (!SendMessage(m_hwndProgress, PBM_SETRANGE, (WPARAM) 0, MAKELPARAM(0, MAX_RANGE)))
+ return false;
return true;
}
@@ -72,7 +73,15 @@
ProgressControl::show()
{
DWORD curPos = (DWORD) ((m_dw64CurrentValue * MAX_RANGE) / m_dw64MaxValue);
- SendMessage(m_hwndProgress, PBM_SETPOS, (WPARAM) curPos, (LPARAM) 0);
+
+ if (!SendMessage(m_hwndProgress, PBM_SETPOS, (WPARAM) curPos, (LPARAM) 0))
+ return false;
return true;
}
+
+int
+ProgressControl::getCurrentPercent()
+{
+ return ((int) ((m_dw64CurrentValue * 100) / m_dw64MaxValue));
+}
\ No newline at end of file