Author: Tomas Rutkauskas
According to Microsoft you could use a progress bar with style set to PBS_MARQUEE
if you don't know the final value. It will show a progress bar with only a gradient
going from left to right. I find no other references to these constants except from
MSDN. Anyone know how to use them in Delphi?
Answer:
It's defined in CommCtrl.h:
#if (_WIN32_WINNT >= 0x0501)
#define PBS_MARQUEE 0x08
#define PBM_SETMARQUEE (WM_USER+10)
#endif // _WIN32_WINNT >= 0x0501
In Delphi (untested):
1 { ... }2 const3 PBS_MARQUEE = $08;
4 PBM_SETMARQUEE = (WM_USER + 10);
5 6 You set this style by subclassing the TProgressBar.CreateParams methods and setting
7 PBS_MARQUEE:
8 9 procedure TMyProgressBar.CreateParams(var Params: TCreateParams);
10 begin11 inherited CreateParams(Params);
12 Params.Style := Params.Style or PBS_MARQUEE;
13 end;
14 15 //You can now turn on the marquee:16 17 SendMessage(MyProgressBar1.Handle, PBS_SETMARQUEE, 1, 200);
18 19 //and off:20 21 SendMessage(MyProgressBar1.Handle, PBS_SETMARQUEE, 0, 200);
The 200 is the number of milliseconds between animation updates.