Advertisement
paulgertzen

Untitled

May 9th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. library Project2;
  2.  
  3. { Important note about DLL memory management: ShareMem must be the
  4. first unit in your library's USES clause AND your project's (select
  5. Project-View Source) USES clause if your DLL exports any procedures or
  6. functions that pass strings as parameters or function results. This
  7. applies to all strings passed to and from your DLL--even those that
  8. are nested in records and classes. ShareMem is the interface unit to
  9. the BORLNDMM.DLL shared memory manager, which must be deployed along
  10. with your DLL. To avoid using BORLNDMM.DLL, pass string information
  11. using PChar or ShortString parameters. }
  12.  
  13. uses
  14. SysUtils,
  15. Classes,
  16. IdBaseComponent, IdComponent, IdTCPConnection,
  17. IdTCPClient, IdFTP;
  18.  
  19. {$R *.res}
  20.  
  21. Type
  22. TFTPContainer = Class(TObject)
  23. Private
  24. FIdFTP: TIdFTP;
  25. Public
  26. procedure FTPOnStatus(ASender: TObject; const AStatus: TIdStatus; const AStatusText: string);
  27. Constructor Create;
  28. Destructor Destroy; override;
  29. End;
  30.  
  31. { CONNECT TO THE FTP SERVER }
  32. function FTPConnect(AHost: String; APort: Integer; AUserName, APassword: String; APassive: Boolean = True): Boolean; stdcall;
  33. Var FTPContainer : TFTPContainer;
  34. begin
  35. FTPContainer := TFTPContainer.Create;
  36. Try
  37. with FTPContainer.FIdFTP do
  38. begin
  39. Host := AHost;
  40. Port := APort;
  41. Username := AUserName;
  42. Password := APassword;
  43. Passive := APassive;
  44. Connect;
  45.  
  46. if Connected then
  47. Result := True
  48. else
  49. Result := False;
  50. end;
  51. Finally
  52. FTPContainer.Free;
  53. End;
  54. end;
  55.  
  56. { EVENTS }
  57. constructor TFTPContainer.Create;
  58. begin
  59. FIdFTP := TIdFTP.Create(nil);
  60. FIdFTP.OnStatus := FTPOnStatus;
  61. // assign the rest of the events here
  62. end;
  63.  
  64. destructor TFTPContainer.Destroy;
  65. begin
  66. FidFTP.Free;
  67. inherited;
  68. end;
  69.  
  70.  
  71. procedure TFTPContainer.FTPOnStatus(ASender: TObject;
  72. const AStatus: TIdStatus; const AStatusText: string);
  73. begin
  74.  
  75. end;
  76.  
  77. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement