AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi [Indy 10] IOHandler hinzufügen
Thema durchsuchen
Ansicht
Themen-Optionen

[Indy 10] IOHandler hinzufügen

Ein Thema von TheMiller · begonnen am 4. Apr 2009 · letzter Beitrag vom 4. Apr 2009
 
Benutzerbild von TheMiller
TheMiller

Registriert seit: 19. Mai 2003
Ort: Gründau
2.480 Beiträge
 
Delphi XE7 Architect
 
#6

Re: [Indy 10] IOHandler hinzufügen

  Alt 4. Apr 2009, 12:04
Naja, was soll denn da nicht stimmen? Hier mal der Code. (Mit Indy 9 hatte alles noch wunderbar funktioniert)

Achso: Der Download findet in einem Thread statt.

Die Zuweisung für das OnWork-Ereignis (Hauptprogramm / Main-Thread)

UpdateDownloader.OnWork:=OnThreadWork; Die Progressbars

Delphi-Quellcode:

//Prozeduren-Kopf in private
procedure OnThreadWork(Sender: TThread; const AWorkCount: Integer);

procedure TForm4.OnThreadWork(Sender: TThread; const AWorkCount: Integer);
begin
  Progressbar1.Position:=AWorkCount;
  Progressbar2.Position:=geladen+AWorkCount;
  //Bringt nix:
  //Progressbar1.Refresh;
  //Progressbar2.Refresh;
end;

Im DownloadThread

Delphi-Quellcode:

TOnWorkEvent = procedure(Sender: TThread; const AWorkCount: Integer) of object;

TDownloadUpdates = class(TThread)
  private
    procedure InternalOnWork(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer);
    procedure DoNotifyWork;
  published
    property OnWork: TOnWorkEvent read FOnWorkEvent write FOnWorkEvent;
  end;

procedure TDownloadUpdates.InternalOnWork(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer);
begin
  FWorkCount:=AWorkCount;
  Synchronize(DoNotifyWork);
end;

procedure TDownloadUpdates.DoNotifyWork;
begin
  if (Assigned(OnWork)) then
    OnWork(Self, FWorkCount);
end;
Das hat so alles funktioniert. Ich hoffe, ich habe alles Wichtige jetzt kopiert.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:47 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz