i need implement a method of callback but i'm having problems in way like am implementing. Can someone help me?
procedure TfrmPrincipal.EnviarArquivo;
var
intf: IDispatch;
ftp2: OleVariant;
begin
try
intf := CreateOleObject('Chilkat95_0.Ftp2');
ftp2 := intf;
try
// Callback
ftp2.onProgressInfo := ftp_onProgressInfo;
if ftp2.unlockComponent('unlocked') <> 1 then
raise Exception.Create(ftp2.LastErrorText);
ftp2.HostName := edtHostName.Text;
ftp2.UserName := edtUserName.Text;
ftp2.PassWord := edtPassWord.Text;
ftp2.Port := StrToInt(edtPort.Text);
ftp2.Passive := 1;
if ftp2.Connect <> 1 then
raise Exception.Create(ftp2.LastErrorText);
if (ftp2.ChangeRemoteDir('IN') <> 1) then
raise Exception.Create(ftp2.LastErrorText);
if (ftp2.PutFile(odlgArquivo.FileName,
ExtractFileName(odlgArquivo.FileName)) <> 1) then
raise Exception.Create(ftp2.LastErrorText);
mmLog.Lines.Add('File sent!!!')
except
on e:exception do
mmLog.Lines.Add(e.Message);
end;
finally
VarClear(ftp2);
end;
end;