Autor Beitrag
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 24.03.04 21:10 
Jetzt sieh Dir endlich mal ein paar Grundlagen an!!

Lines ist ein Objekt, die zu vergleichen macht keinen Sinn! Deswegen habe ich eben geschrieben, wie Du auf die einzelnen Zeilen zugreifen kannst.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 24.03.04 21:12 
Ganz ruhig...

THX, es geht mit den Lines!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 24.03.04 21:15 
Zitat:
Ganz ruhig...
Entschuldigung ...

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 24.03.04 21:37 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.UpdateSucheClick(Sender: TObject);
const
Path = 'c:\test.txt';
Path2 = 'c:\test2.txt';
begin
  MyVersionRich.Lines.LoadFromFile(Path);
  IEVersionRich.Lines.LoadFromFile(Path2);
  if MyVersionRich.Lines[1] = IEVersionRich.Lines[1]   then
  ShowMessage('Kein Update notwendig!')
  else
  ShowMessage('Bitte Updaten!')
end;

procedure TForm1.AbbruchButtonClick(Sender: TObject);
begin
Close;
end;



So geht's und so könnte eine Updatefunktion aussehen.


Zuletzt bearbeitet von GTA-Place am Di 01.01.08 13:27, insgesamt 2-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 24.03.04 21:47 
Hallo!

Läuft das Programm so? Denn Du greifst auf die zweiten Zeilen zu, die Erste hätte den Index 0 und nicht 1.

MfG
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 24.03.04 21:47 
Noch ne Frage:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
begin
     FileOnNet:='http://gta-place.s3.cybton.com/test2.txt';
     LocalFileName:='test2.txt';
  MyVersionRich.Lines.LoadFromFile(Path);
  IEVersionRich.Lines.LoadFromFile(Path2);
  if MyVersionRich.Lines[1] = IEVersionRich.Lines[1]   then
  ShowMessage('Kein Update notwendig!')
  else
  ShowMessage('Bitte Updaten!')
end;


Wie mach ich es, dass das Prog. wartet bis die TxtDatei runtergeladen ist und dann erst öffnet, sonst bekomm ich eine fehlermeldung
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 24.03.04 22:46 
Wie sieht denn der Download bisher aus?

P.S: Du brauchst mir keine PNs schicken, in denen steht, welche Threads ich mir ansehen soll ... ich lese sowieso fast alles. :-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
NetFalcon
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 59

Guitar Player

BeitragVerfasst: Mi 24.03.04 23:35 
Hi GTA-Place,

ein paar Dinge zum Anfang

Du liest 1. die falschen Zeilen aus! Der Index muss 0 sein nicht 1

2ten ist es mit INDY ein einfaches downlaod geschwindigkeit/status etc auszulesen
man müsste nur ein bisschen lesen
www.delphi-source.de...torials/indy/?page=5
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 25.03.04 08:09 
Gibts denn keinen "Wait"-Befehl?
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 25.03.04 10:08 
Wie lädst du denn die Datei herunter?

Wenn du mit der Komponente TIDHttp und dem Befehl Get etwas herunterlädst, wird automatisch gewartet...

Cu,
Udontknow
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 25.03.04 14:27 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
uses Wininet;

function GetInetFile (const fileURL, FileName: String): boolean;
const BufferSize = 1024;
var hSession, hURL: HInternet;
    Buffer: array[1..BufferSize] of Byte;
    BufferLen: DWORD;
    f: File;
    sAppName: string;
begin
     Result   := False;
     sAppName := ExtractFileName(Application.ExeName);
     hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nilnil0);
     try
        hURL := InternetOpenURL(hSession, PChar(fileURL), nil,0,0,0);
        try
           AssignFile(f, FileName);
           Rewrite(f,1);
           repeat
                 InternetReadFile(hURL, @Buffer,
                 SizeOf(Buffer), BufferLen);
                 BlockWrite(f, Buffer, BufferLen)
           until BufferLen = 0;
           CloseFile(f);
           Result:=True;
        finally
               InternetCloseHandle(hURL)
        end
     finally
            InternetCloseHandle(hSession)
     end
end;

(Quelle: home.arcor.de/hardcoders/)

Das und das:

ausblenden Delphi-Quelltext
1:
2:
FileOnNet:='http://gta-place.s3.cybton.com/test2.txt'
LocalFileName:='test2.txt';


verwend ich
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 25.03.04 20:22 
Ich lese ja das Tutorial durch :roll: , aber noch eine Frage:

Scheinbar lädt Delphi die Datei nicht herunter. Kann man statt die TxtDatei runterzuladen, auch gleich auf dem Server auf sie zugreifen und auslesen? Wahrscheinlich schon, denn
gta-place.s3.cybton.com/test2.txt
und man kann ja von Delphi aus auf eine Website draufzugrefeifen, also auch auf die TxtDatei.
Also mal schnell das Internet durchsuchen (Eigeninitiative :D )
Mh...
*Nix Find*
Dann mal weitersuchen und Prob. selber lösen...

EDIT: Schon was gefunden, also Indy runterladen und los geht´s (das programmieren)
EDIT2: Stellen wir uns mal vor: Ich hab D3 und Indy ist erst ab D4. Was macht man dann?
EDIT3: Man versucht es anders...
EDIT4: Ich verzweifel langsam... Da hilft das Tut wahrscheinlich auch nicht mehr... D muss doch irgendwie die Seite auslesen können...
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Do 25.03.04 21:12 
Zitat:
Scheinbar lädt Delphi die Datei nicht herunter. Kann man statt die TxtDatei runterzuladen

Per HTTP - Nein.

Zitat:
Wahrscheinlich schon, denn
gta-place.s3.cybton.com/test2.txt
und man kann ja von Delphi aus auf eine Website draufzugrefeifen, also auch auf die TxtDatei.

Die Datei wird lokal gecached - es fällt dir nur nicht auf, weils so schnell geht.

Zitat:
EDIT3: Man veruscht es anders...

Suche in: Delphi-Forum, Delphi-Library URLDOWNLOADTOFILE

Zitat:
Ich lese ja das Tutorial durch ...

Sehr gute Idee ... ich hab da noch was für dich: Click !

//Edit: URL-Tag.

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.


Zuletzt bearbeitet von MaxiTB am Do 25.03.04 21:27, insgesamt 2-mal bearbeitet
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 25.03.04 21:16 
1. Wenn ich auf die Suche klicke finde ich diesen Thread wieder.
2. Tolles Tutorial, endlich mal richtig fragen!
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Do 25.03.04 21:23 
1. :roll: Is echt eine Überraschung, daß der erste Link wieder hier her führt ... aber das tolle an der Suche, man hat eine Menge Alternativen und es gibt mindestens hundert, die sind Treffer. Jetzt bist also du an der Reihe.

2. :? Schon gelesen ? Hoffe ich ja doch, ich denke, du kannst die Tipps dort noch brauchen.

//Edit: Oder ich hab mich vertippt und es gibt nur einen Treffer :oops: - korregiert und es sind immerhin 33. Na, das ist doch was !

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 25.03.04 21:28 
Es hat funktioniert!
Er ladet die Datei runter und startet sie dann!

THX Peter Lustig, Udontknow, NetFalcon und MaxiTB!
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 25.03.04 22:43 
Jetzt nur noch eine einzige Frage:

Wenn Delphi die Datei nicht downloaden kann (z.B. keine Internetverbindung) dann soll es eine Fehlermeldung anzeigen (z.B. "Keine Internetverbindung?") und nicht gleich das Prog. abstürzen lassen.
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Do 25.03.04 22:59 
Mädl, du solltest wirklich mehr die Online Hilfe von Delphi lesen.
Oder die Sachen, die wir dir schreiben.

UrlDownloadToFile z.b. gibt eine HRESULT zurück, und Indy kannst du per try...except Exceptions abfangen.

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 26.03.04 19:13 
1. Bin kein Mädl.
2. Ich kann kein Indy verwenden
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 03.04.04 16:40 
Du hättest auch einfach sagen können:

Mit "try" und "except" kannst du Fehler abfangen.

So gehts nämlich.