CProgress progress bar indicator class Features 1. Choice or either solid bar or "block" type bar 2. Choice of background and forground colors 3. Create with or without a 3D border - bar size adjusts automatically 4. Choice of number of "blocks" when using "block" type bar to control granularity of indication. 5. Easy to use drop-in design. Suitable for use in any CWnd-derived class or window such as view objects, dialogs, toolbars or status bars. Any CWnd object that you can get a pointer to can be the parent of CProgress. 6. If the solid bar is specified too small for the counter text to be shown without clipping, the text is not used. If the size of the progress bar is specified as a percentage of the parent window, and if the parent window is then resize so that the counter text would not be clipped, the text will reappear. 7. If text is specified for a "block" type progress bar, the specification is ignored. 8. Painting of the bar or blocks is done so as to prevent "flickering". Contents of package - 3 files Progress.cpp Progress.h Progress.txt How to use CProgress class First, copy Progress.h and Progress.cpp into your project directory. Insert progress.cpp into your project. 1. Instantiate an instance of CProgress in the header file of the parent-to-be such as a dialog class. CProgress m_Progress; 2. include the CProgress class header file in the parent implementation file. #include "progress.h" 3. Create the CProgress window at a place in your parent class where CProgress will have a sufficient life expectancy. In a dialog class, use OnInitDialog(), for instance. CRect rcBarRect(10,20,110,35); m_Progress.Create(this, // parent object rcBarRect.left, // upper left corner of bar rcBarRect.top, rcBarRect.Width(), // width of bar rcBarRect.Height(), // height of bar TRUE, // use 3D border around bar TRUE, // use counter text if solid bar type RGB(128,0,0), // foreground (bar)color RGB(192,192,192)); // background color m_Progress.ClearMeter(); 4. To use a "block" type meter in some lengthy calculation, do something like the following. void CMyDialog::OnCalculate() { long counter = 0; // clear contents of meter from previous use m_Progress.ClearMeter(); while(counter < 1000001) { // meter will have 50 steps or blocks m_Progress.Meter(counter, (long)1000000, 50); counter++; } } 5. For a solid progress bar, use the example in step 4, but remove the "step" parameter (the 50). 6. Rebuild your project and test. Cecil A. Galbraith CustomSoft http://www.concentric.net/~cgalbrai 3217 Linden Parkway Harrisburg, Pa. 17110 cgalbrai@concentric.net