Startseite ¦  was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews ¦  sonstiges
kylix ¦  tutorials ¦  online shop ¦  fotos ¦  Add&Win Gewinnspiel


Willkommen Gast. Bitte einloggen oder registrieren.
22.05.2012, 13:42:35
Übersicht Hilfe Suche Einloggen Registrieren

+  SwissDelphiCenter Forum
|-+  English Forums
| |-+  General Forum
| | |-+  Application update
« vorheriges nächstes »
Seiten: [1] Drucken
Autor Thema: Application update  (Gelesen 2266 mal)
johan
Gast
« am: 19.09.2003, 20:20:33 »

Hi,

I'm writing a text editor in Delphi, and I want the users to be able to download updates from internet from within my application. I know how to download a file from the internet, but I don't know how to display the percentage of the file that has been downloaded. I also want to display the progress of the download, but when I start downloading the file, the program freezes until the download is complete. I hope someone understands what I mean.

Please help me.
Gespeichert
Chef
Hero Member
*****
Offline Offline

Beiträge: 812

99519365
WWW
« Antworten #1 am: 19.09.2003, 20:53:17 »

Put the download-procedure in a thread. Do you know how to use threads?

Regards,
Jörg
Gespeichert

Diese Nachricht wurde maschinell erstellt und ist ohne Unterschrift gültig.

www.accessviolation.de
johan
Gast
« Antworten #2 am: 19.09.2003, 22:03:14 »

No. I don't know how to use threads in Delphi (I've used threads in Java, so I know what it is). Could you write an exampel on how to use threads in Delphi?
Gespeichert
Chef
Hero Member
*****
Offline Offline

Beiträge: 812

99519365
WWW
« Antworten #3 am: 22.09.2003, 09:51:21 »

A great example (I could hardly write a better one) is the thread demo given with your Delphi. It's in the subdirectory /demos/threads.

Regards,
Jörg
Gespeichert

Diese Nachricht wurde maschinell erstellt und ist ohne Unterschrift gültig.

www.accessviolation.de
johan
Gast
« Antworten #4 am: 22.09.2003, 12:08:30 »

Thanks. But I got it to work with the following code:
[a href="http://www.swissdelphicenter.ch/en/showcode.php?id=1095" target="_blank"]http://www.swissdelphicenter.ch/en/showcod...ode.php?id=1095[/a]

It downloads a file from a FTP server and displays the progress in a TProgressBar and a TLabel
Gespeichert
Mackhack
Gast
« Antworten #5 am: 11.10.2003, 02:36:38 »

Zitat
Thanks. But I got it to work with the following code:
[a href="http://www.swissdelphicenter.ch/en/showcode.php?id=1095" target="_blank"]http://www.swissdelphicenter.ch/en/showcod...ode.php?id=1095[/a]

It downloads a file from a FTP server and displays the progress in a TProgressBar and a TLabel

Does anybody know why the ProgressBar and the Label does not display the correct informations if the file has a size of about 100 MB!!!

The ProgressBar starts more than 1 time from the startpoint and the per cent info starts from the startpoint more than 1 time, too!!!

Thx
Gespeichert
Tokter
Gast
« Antworten #6 am: 11.10.2003, 20:08:40 »

Probably your position goes hiher than the max value of the Progressbar...
Gespeichert
BenBE
Hero Member
*****
Offline Offline

Beiträge: 1441


318219379 BenBE@xiondigital.net BenBE1987 ookyBenBE
WWW
« Antworten #7 am: 11.10.2003, 21:28:29 »

The problem is another: The Value of Position * 100 / Size get at the multiplication to high
change the brakets: Position / (Size / 100)

Its the same, but reduces the maximum of the expression (the first gets over the upper range of an integer at about 21.4 MBs (21.4 * 1024 * 1024 * 100 = 2,147,000,000 ...)
Gespeichert

Je komplexer das System, desto kleiner die Fehler; je kleiner die Fehler, desto häufiger ihr Auftreten!
Mackhack
Gast
« Antworten #8 am: 11.10.2003, 21:59:27 »

Do you mean this line?

Code:

ProgressBar.Position := Round(dwBytesRead * 100 / fileSize);



Zitat

Position / (Size / 100)

But why 2 times divide?
Gespeichert
Mackhack
Gast
« Antworten #9 am: 11.10.2003, 22:31:45 »

Hi @ all:

It works...

Code:

ProgressBar.Position := Round(dwBytesRead * (100 / filesize));



Thank you!!!
Gespeichert
Seiten: [1] Drucken 
« vorheriges nächstes »
Gehe zu:  


Einloggen mit Benutzername, Passwort und Sitzungslänge

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Prüfe XHTML 1.0 Prüfe CSS