Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library Project2;
- { Important note about DLL memory management: ShareMem must be the
- first unit in your library's USES clause AND your project's (select
- Project-View Source) USES clause if your DLL exports any procedures or
- functions that pass strings as parameters or function results. This
- applies to all strings passed to and from your DLL--even those that
- are nested in records and classes. ShareMem is the interface unit to
- the BORLNDMM.DLL shared memory manager, which must be deployed along
- with your DLL. To avoid using BORLNDMM.DLL, pass string information
- using PChar or ShortString parameters. }
- uses
- SysUtils,
- Classes,
- IdBaseComponent, IdComponent, IdTCPConnection,
- IdTCPClient, IdFTP;
- {$R *.res}
- Type
- TFTPContainer = Class(TObject)
- Private
- FIdFTP: TIdFTP;
- Public
- procedure FTPOnStatus(ASender: TObject; const AStatus: TIdStatus; const AStatusText: string);
- Constructor Create;
- Destructor Destroy; override;
- End;
- { CONNECT TO THE FTP SERVER }
- function FTPConnect(AHost: String; APort: Integer; AUserName, APassword: String; APassive: Boolean = True): Boolean; stdcall;
- Var FTPContainer : TFTPContainer;
- begin
- FTPContainer := TFTPContainer.Create;
- Try
- with FTPContainer.FIdFTP do
- begin
- Host := AHost;
- Port := APort;
- Username := AUserName;
- Password := APassword;
- Passive := APassive;
- Connect;
- if Connected then
- Result := True
- else
- Result := False;
- end;
- Finally
- FTPContainer.Free;
- End;
- end;
- { EVENTS }
- constructor TFTPContainer.Create;
- begin
- FIdFTP := TIdFTP.Create(nil);
- FIdFTP.OnStatus := FTPOnStatus;
- // assign the rest of the events here
- end;
- destructor TFTPContainer.Destroy;
- begin
- FidFTP.Free;
- inherited;
- end;
- procedure TFTPContainer.FTPOnStatus(ASender: TObject;
- const AStatus: TIdStatus; const AStatusText: string);
- begin
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement