Autor Beitrag
NetZwerg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 14.03.04 09:55 
Hallo,

ich habe vorhin mal versucht, eine Datei (.bmp und .txt) aus dem Internet zu laden.

ausblenden Quelltext
1:
2:
Image1.Picture.LoadFromFile('http://adresse.des.Bildes.bmp');
Memo1.Lines.LoadFromFile('http://adresse.des.Textes.txt');


Wenn ich jetzt das Programm starte, kriege ich folgende Meldung:
Die Datei adresse.des.Bildes.bmp kann nicht geladen werden, obwohl ich online bin!? Natürlich habe ich statt Adresse.des.Bildes eine Bilddatei angegeben.

cYa, Dave :twisted:

Moderiert von user profile iconPeter Lustig: Topic verschoben

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 14.03.04 10:09 
Das liegt daran, dass mit TPicture.LoadFromFile eine Datei von einem Datenträger geöffnet werden soll. Dann sucht das Programm nach dem Datenträger http, den es wohl nicht gibt.

Deshalb musst du dass Bild erst herunterladen. Eine Möglichkeit wäre
ausblenden Delphi-Quelltext
1:
URLDownloadToFile(NIL, PChar(Url), PChar(Datei), 0, NIL);					

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 14.03.04 10:16 
Natürlich funktioniert mal wieder nix in Delphi 3.... :evil: :evil: Trotzdem danke...

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 14.03.04 11:02 
Binde mal die Unit URLMon in die uses-Klausel ein.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 14.03.04 11:14 
Fast perfekt (THX!), aber er sagt, dass die Datei beschädigt ist und das er sie nicht öffnen kann... Und wie kriegt man das mit dem URLMon oder beim programm öffnen mit dem ShellAPI raus?

cYa, Dave :twisted:

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 14.03.04 11:16 
Oh, hab die URL falsch angegeben... :mrgreen: Also, geht jetz, aber wie krieg ich das raus, was ich einbinden muss?

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 14.03.04 11:55 
Im PSDK (Platform Software Development Kit) von Microsoft findest du diese API Funktionen und dort findest du auch die Header (das, was du in die uses-Klausel schreibst).

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 14.03.04 11:59 
Is das kostenlos? Hab's auf der MS-Seite nicht gefunden... :roll:

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 14.03.04 12:14 
Ja das gibt es kostenlos.

Hier ist der Link.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 14.03.04 15:53 
guuuuuut! :D Jetzt noch 'ne frage zum Thema:

1. Wie kann ich die Größe der Ziel-Datei angeben?
2. Wie kann ich die bisher runtergeladene Datenmenge (nur von dieser Datei) angeben?

cYa, Dave :twisted:

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: Mo 15.03.04 18:51 
huihui, nochmehr fragen:

Ich möchte, dass mir das Programm sagt, ob der Download erfolgreich war oder nicht.
Gut und schön, ich hab's so versucht:

ausblenden Delphi-Quelltext
1:
2:
3:
if URLDownloadToFile(NIL, PChar('http://die.datei.bmp/'), PChar('C:\Dokumente und Einstellungen\Owner\Desktop\die.datei.bmp'), 0, NIL)
then ShowMessage('Download erfolgreich!')
else ShowMessage('Download nicht erfolgreich!');


Fehler: Ausdruck muss Boolean sein!?

Wie mach ich das jetz richtig?? :mrgreen:

THX, Dave :twisted:

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mi 17.03.04 15:54 
Das Problem ist ganz klar:

URLDownloadToFile liefert einen Rückgabewert vom Typ hResult und nicht Boolean. Daher ist eine direkte if Abfrage nutzlos (das sagt auch der Compiler).

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if URLDownloadToFile(...) = S_OK then
  ...
else
  ...


Das sollte funktionieren.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 21.03.04 16:51 
NetZwerg hat folgendes geschrieben:
guuuuuut! :D Jetzt noch 'ne frage zum Thema:

1. Wie kann ich die Größe der Ziel-Datei angeben?
2. Wie kann ich die bisher runtergeladene Datenmenge (nur von dieser Datei) angeben?

cYa, Dave :twisted:


thx! gut, und dass?

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 21.03.04 17:09 
Kuck mal in der FAQ nach Suche in: Delphi-Forum, Delphi-Library URLDOWNLOADTOFILE.
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 21.03.04 17:15 
jo, thx! :D

PS: "Kucken" chreibt man mit G! :wink:

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 21.03.04 17:31 
NetZwerg hat folgendes geschrieben:
jo, thx! :D

PS: "Kucken" chreibt man mit G! :wink:

Und chreiben mit "s". Aber hast du schon mal im Duden gekuckt? ;)