• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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      
0
ProgsX
Asked:
ProgsX
  • 2
1 Solution
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now