Autor Beitrag
undergroundgamer
Hält's aus hier
Beiträge: 5

WinXP Pro SP2
Borland Developer Studio 2006 & Visual Studio.net 2005
BeitragVerfasst: So 02.07.06 21:42 
Hi Leute,

Ich versuch schon seit einigen Tagen über Delphi eine Textdatei von einem
Server zu öffnen (z.b. Funpic) und dann in ein Memo Fenster ausgeben zu lassen.
Ich krieg das einfach nicht hin. Geht das überhaupt ? wenn ja wie ?

Dickes THX im vorraus
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 02.07.06 21:52 
Schau mal nach INDY, Synapse, ICS usw, dann wirst du viele Beispiele finden wie man auf Dateien über HTTP zugreifen kann.

_________________
Markus Kinzler.
Arno Nym
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131



BeitragVerfasst: So 02.07.06 21:53 
Hi!
ich benutze dafür folgende Methode:

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:
33:
34:
35:
36:
37:
38:
39:
uses WinInet,
     WinSock;

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,INTERNET_FLAG_RELOAD,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;


Mit freundlichen Grüßen,
Arno Nym
undergroundgamer Threadstarter
Hält's aus hier
Beiträge: 5

WinXP Pro SP2
Borland Developer Studio 2006 & Visual Studio.net 2005
BeitragVerfasst: So 02.07.06 23:00 
Also ich kann mich nur einmal richtig fett bei dir bedanken
danke ;)
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Mo 03.07.06 17:24 
Ich nehm da immer
USES UrlMon

URLDownloadToFile(...);

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse