from palm-dev e-mail list, credit goes to Logan Shaw
typedef struct { RectangleType bounds; WinHandle savedbits; } ProgBar; void OpenProgressBar (ProgBar *progbar) { UInt16 savebitserror; progbar->savedbits = WinSaveBits (& progbar->bounds, & savebitserror); WinEraseRectangle (& progbar->bounds, 0); } void CloseProgressBar (ProgBar *progbar) { if (progbar->savedbits) { WinRestoreBits ( progbar->bounds.topLeft.x, progbar->bounds.topLeft.y, progbar->savedbits); } else { /* maybe should enqueue a frmUpdateEvent instead, maybe not */ WinEraseRectangle (& progbar->bounds, 0); } } void UpdateProgressBar (ProgBar *progbar, Int32 numerator, Int32 denominator) { RectangleType fillrect; RctCopyRectangle (& progbar->bounds, & fillrect); fillrect.extent.x = progbar->bounds.extent.x * numerator / denominator; WinDrawRectangle (& fillrect, 0); } void TestProgressBar () { Int32 i; const Int32 max = 25; ProgBar progbar; progbar.bounds.topLeft.x = 20; progbar.bounds.topLeft.y = 70; progbar.extent.x = 120; progbar.extent.y = 20; OpenProgressBar (& progbar); for (i = 0; i <= max; i++) { UpdateProgressBar (& progbar, i, max); SysTaskDelay (SysTicksPerSecond() / 5); } CloseProgressBar (& progbar); }