Carlo
2006-07-04 09:31:17 UTC
Hi, i am testing a particoular use of dll in Delphi.
I have an application with a component TidFtp1 (indy client ftp) and i
set up host, user and password.
I want to do the connection of TidFtp1 via dll and i need to pass the
TidFtp1 component from application to dll.
My dll must return True in connection is ok, False if connection isn't
ok.
When connection is ok, the TidFtp1 component of my application, must be
connected and i would like to use it for files update/download
(get...put...etc).
I write this code, but TidFtp1 of my application, can't connect:
// *******************
// DLL
// *******************
uses
...... IdFTP, IdAntiFreezeBase;
function _FtpConnect(_IdFtp: TIdFtp): Boolean; stdcall;
begin
try
if _IdFTP.Connected=False then
_IdFTP.Connect;
Result:=True;
except
Result:=False;
end;
end;
// *******************
// APPLICATION
// *******************
function _FtpConnect(_IdFtp: TIdFtp): Boolean;
stdcall; external 'filelib.dll';
if _FtpConnect(idFTP1)=True then
showmessage('connection ok')
else
showmessage('connection error');
Someone can help me?
Thanks
I have an application with a component TidFtp1 (indy client ftp) and i
set up host, user and password.
I want to do the connection of TidFtp1 via dll and i need to pass the
TidFtp1 component from application to dll.
My dll must return True in connection is ok, False if connection isn't
ok.
When connection is ok, the TidFtp1 component of my application, must be
connected and i would like to use it for files update/download
(get...put...etc).
I write this code, but TidFtp1 of my application, can't connect:
// *******************
// DLL
// *******************
uses
...... IdFTP, IdAntiFreezeBase;
function _FtpConnect(_IdFtp: TIdFtp): Boolean; stdcall;
begin
try
if _IdFTP.Connected=False then
_IdFTP.Connect;
Result:=True;
except
Result:=False;
end;
end;
// *******************
// APPLICATION
// *******************
function _FtpConnect(_IdFtp: TIdFtp): Boolean;
stdcall; external 'filelib.dll';
if _FtpConnect(idFTP1)=True then
showmessage('connection ok')
else
showmessage('connection error');
Someone can help me?
Thanks