This will show the progress in the progress bar:
procedure Tfmain.Open1Click(Sender: TObject);
begin
with ImageEnView1.IO.DShowParams do
begin
if State = gsRunning then
begin
Stop;
Disconnect;
end;
if OpenDialog1.Execute then
begin
FileInput := OpenDialog1.FileName;
EnableSampleGrabber := true;
RenderAudio := true;
Connect;
Position := 0;
Pause; // This shows first frame
ImageEnView1.IO.DShowParams.TimeFormat := tfFrame;
ProgressBar1.Max := ImageEnView1.IO.DShowParams.Duration;
ProgressBar1.Position := 0;
Percent1.Caption := IntToStr(0) + '%';
end;
end;
end;
procedure Tfmain.ImageEnView1DShowNewFrame(Sender: TObject);
var
iMax: Int64;
iFrame: Int64;
iPosition: Int64;
iPercent: integer;
begin
with ImageEnView1 do
begin
IO.DShowParams.GetSample(IEBitmap);
iMax := ImageEnView1.IO.DShowParams.Duration;
iFrame := IO.DShowParams.Position;
ProgressBar1.Position := iFrame;
ProgressBar1.Position := iFrame-1;
ProgressBar1.Position := iFrame;
ProgressBar1.Update;
Percent1.Caption := FormatFloat('###', (iFrame / iMax) * 100) + '%';
Percent1.Update;
Update;
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development