![]() |
Re: Abfrage
Stimmt, da war ich irgendwie blind, ich hatte genau danach geschaut und das nicht gefunden. :gruebel:
Delphi-Quellcode:
procedure TIdFTP.Get(const ASourceFile: string; ADest: TStream; AResume: Boolean = False);
|
Re: Abfrage
Ich versteh die Welt nicht mehr ...
Hier Mein Code...
Delphi-Quellcode:
und
unit Chat1;
interface uses Windows, WinInet, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, jpeg, ExtCtrls, StdCtrls, Login; type TForm1 = class(TForm) Image1: TImage; Button1: TButton; Frame11: TFrame1; procedure Button1Click(Sender: TObject); procedure Frame11CancelBtnClick(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} function putfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean; var hopen, hconnect: HINTERNET; begin hopen := InternetOpen('myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0); hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); Result := FtpPutFile(hconnect, pchar(localfile), pchar(remotefile), FTP_TRANSFER_TYPE_UNKNOWN, 0); InternetCloseHandle(hconnect); end; function getfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean; var hopen, hconnect: HINTERNET; begin hopen := InternetOpen('myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0); hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); Result := FtpGetFile(hconnect, pchar(localfile), pchar(remotefile), false, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0); InternetCloseHandle(hconnect); end; procedure TForm1.Button1Click(Sender: TObject); begin Frame11.Show; Button1.Hide; end; procedure TForm1.Frame11CancelBtnClick(Sender: TObject); begin ShowMessage('...wird beendet.'); close; end; end.
Delphi-Quellcode:
unit Login;
interface uses Windows, WinInet, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TFrame1 = class(TFrame) Label1: TLabel; Password: TEdit; OKBtn: TButton; CancelBtn: TButton; Label2: TLabel; Edit1: TEdit; procedure OKBtnClick(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; implementation {$R *.dfm} function putfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean; var hopen, hconnect: HINTERNET; begin hopen := InternetOpen('myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0); hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); Result := FtpPutFile(hconnect, pchar(localfile), pchar(remotefile), FTP_TRANSFER_TYPE_UNKNOWN, 0); InternetCloseHandle(hconnect); end; function getfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean; var hopen, hconnect: HINTERNET; begin hopen := InternetOpen('myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0); hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); Result := FtpGetFile(hconnect, pchar(localfile), pchar(remotefile), false, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0); InternetCloseHandle(hconnect); end; procedure TFrame1.OKBtnClick(Sender: TObject); var Datei: TextFile; MyFile: TStringList; PasswordMatches: Boolean; begin getfile('ip', 'benutzer', 'pw', 'verzeichniss' + Edit1.Text + '.txt', Edit1.Text + '.txt'); MyFile := TStringList.Create; try MyFile.LoadFromFile(Edit1.text + '.txt'); PasswordMatches := Trim(MyFile.text) = 'Edit2.text'; finally MyFile.Free; end; end; end. |
Re: Abfrage
Du ignorierst den Rückgabewert von getfile...
Delphi-Quellcode:
Aber ich lese da gerade "unit Chat1"?!? Willst du so einen Chat machen? :pale: :shock: Das ist hoffentlich nicht dein Ernst...
if getfile(...) then
... Jedenfalls würdest du dir das Leben wie gesagt leichter machen, wenn du einfach die Indy Komponenten und TIdFtp benutzen würdest. Dann brauchst du dich nicht mit den komplizierteren Befehlen InternetOpen, FtpGetFile, ... herumschlagen, die du im Moment kopiert hast benutzt... |
Re: Abfrage
Nein, es soll kein Chat sein. Es soll mehr eine art wie soll ich es nennen...zwischenspeicher sein.
Danke fürn Befehl: [quote="jaenicke"]
Delphi-Quellcode:
if getfile(...) then
... Wer morgen mal weiter probieren... gn8 |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:51 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