problem with NMSMTP1 and progressbar

I use the component (NMSMTP1) and a progressbar, and I am not create to make it function.

procedure TSendForm.Timer1Timer(Sender: TObject);
begin
  ProgressBar1.Position := NMSMTP1.BytesSent;
  StatusBar1.Panels.Items[0].Text := IntToStr(NMSMTP1.BytesSent);
  StatusBar1.Panels.Items[1].Text := IntToStr(NMSMTP1.BytesTotal);
end;

procedure TSendForm.NMSMTP1SendStart(Sender: TObject);
begin
  ProgressBar1.Max := NMSMTP1.BytesTotal;
  ProgressBar1.Min := 0;
end;

help me      
ProgsXAsked:
Who is Participating?
 
bernaniCommented:

Maybe you need to use the NMSMTP1PacketSent event:


procedure TForm1.NMSMTP1PacketSent(Sender: TObject);
var
i: integer;
begin
  with ProgressBar1 do
  begin
    Min := 0;
    Max := NMSMTP1.BytesTotal;
    for i := Min to Max do
    begin
      Position := NMSMTP1.BytesSent;
      StatusBar1.Panels.Items[0].Text := IntToStr(NMSMTP1.BytesSent) + ' Bytes send on ' + inttostr(NMSMTP1.BytesTotal);
    end;
  end;
StatusBar1.Panels.Items[1].Text := IntToStr(NMSMTP1.BytesTotal);
end;

Hope this help.
0
 
bernaniCommented:
ProgsX,

did you test the code above ? Does it work for you ? Any feedback ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.