PStat v1.24 A
generalized framework for
executing a lengthy operation in a thread.
For developers who use MFC, this is a module which provides
a single easy to use function which allows one of your functions to be executed in a
separate thread. The sample application included with PStat allows you to calculate the
100,000th prime number both with and without pstat. When executed without PStat you will
notice that the sample application becomes totally hung and fails to respond to window
messages. With PStat you have no such problems.
When executed with PStat, while your function is being executed a
progress dialog will be displayed as:
If you want to allow the user to cancel the operation during your
function then the progress dialog can be displayed with a cancel button as:
The function PStat provides allows a number of values to be
modified, these include the caption to use on the progress dialog and the priority to use
when executing the thread. The enclosed zip file contains
source for the routine and also includes a VC 6 workspace file to build a small dialog based
app which calculates the 100,000th prime number both with and without PStat.
- You are allowed to include the source code in
any product (commercial, shareware, freeware or otherwise) when your product
is released in binary form.
- You are allowed to modify the source code in
any way you want except you cannot modify the copyright details at the top
of each module.
- If you want to distribute source code with
your application, then you are only allowed to distribute versions released
by the author. This is to maintain a single distribution point for the
v1.0 (27 March 1997)
v1.1 (18 February 1998)
- Fixed a bug where the worker thread was trying to close a dialog
before it was created. A CEvent member of CProgressThreadDlg
now protects this. Also removed the usual AppWizard comments from the demo program.
v1.2 (8 November 1998)
- Added an option to confirm cancel by means of a message box.
- General tidy up of the code.
- Inclusion of VC 5 workspace files now as standard.
- All code now compiles cleanly at warning level 4.
- Code now supports UNICODE and build configurations are now provided.
- HTML help file now provided.
v1.21 (28 March 2000)
- Changed dialog resources which pstat uses to use the
- Update documentation about its usage.
v1.22 (31 March 2000)
- Fixed a race condition which existing in the worker thread. The issue was that the dialog could be closed before the CSingleLock
destructor was called in the worker thread which resulted in an access violation.
v1.23 (3 February 2003)
- Re-implemented a busy loop using a CEvent in
- Implemented synchronous closure of the worker thread.
- Updated copyright details.
v1.24 (23 July 2007)
- Updated copyright details.
- Optimized CProgressThreadDlg constructor code.
- CProgressThreadInfo is now no longer derived from CObject as it was not
- Code now uses newer C++ style casts instead of C style casts.
- Addition of a CPROGRESSTHREADDLG_EXT_CLASS preprocessor macro to make
the code easier to use in an extension dll.
- Restructured code to avoid need for internal CProgressThreadInfo class.
- Made the Cancel button's ID on the IDD_PSTAT_PROGRESS_WITH_CANCEL "IDCANCEL".
- Code now internally thread protects the "m_bCancelled" and "m_bOkToClose"
- FUNCTION_WITH_PROGRESS function is now declared as PSTAT_FUNCTION and
returns a void. It is also now scoped in the CProgressThreadDlg class.
- Updated sample app to clean compile on VC2005.
- Updated the documentation to use the same style as the web site.