X
xmjli
Unregistered / Unconfirmed
GUEST, unregistred user!
请教各位dll问题,多谢
在下,写了一个dll,实现ftp,在dll中添加了form,和nmftp控件如下:
unit formftp;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Psock, NMFtp, ComCtrls;
type
TForm1 = class(TForm)
NMFTP1: TNMFTP;
StatusBar1: TStatusBar;
Edit1: TEdit;
procedure NMFTP1Connect(Sender: TObject);
procedure NMFTP1ConnectionFailed(Sender: TObject);
procedure NMFTP1PacketRecvd(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure ftptest (); stdcall;
implementation
{$R *.DFM}
procedure ftptest ();stdcall;
var
Form1:TForm1;
begin
Form1 := TForm1.Create (Application);
Form1.Show;
Form1.NMFTP1.host:='10.1.101.45';
Form1.NMFTP1.port:=21;
Form1.NMFTP1.UserID :='test';
Form1.NMFTP1.Password :='ftptest';
try
Form1.NMFTP1.connect;
except
end;
end;
procedure TForm1.NMFTP1Connect(Sender: TObject);
var
Form1 : TForm1;
begin
try
Form1.nmftp1.Download('test1m.dat' ,'c: est1m.dat' );
except
end;
//Form1.nmftp1.Disconnect;
//Form1.free;
end;
procedure TForm1.NMFTP1ConnectionFailed(Sender: TObject);
var
Form1 : TForm1;
begin
end;
procedure TForm1.NMFTP1PacketRecvd(Sender: TObject);
var
Form1 : TForm1;
begin
end;
end.
此时,执行无误,但如果在TForm1.NMFTP1Connect中把Form1.nmftp1.Disconnect;或Form1.free;加入后,就不传输文件了,但同样的方法在exe程序中却是可以用的.
在此,请教各位,如何把nmftp disconnect掉,并把form 关掉.多谢!
在下,写了一个dll,实现ftp,在dll中添加了form,和nmftp控件如下:
unit formftp;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Psock, NMFtp, ComCtrls;
type
TForm1 = class(TForm)
NMFTP1: TNMFTP;
StatusBar1: TStatusBar;
Edit1: TEdit;
procedure NMFTP1Connect(Sender: TObject);
procedure NMFTP1ConnectionFailed(Sender: TObject);
procedure NMFTP1PacketRecvd(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure ftptest (); stdcall;
implementation
{$R *.DFM}
procedure ftptest ();stdcall;
var
Form1:TForm1;
begin
Form1 := TForm1.Create (Application);
Form1.Show;
Form1.NMFTP1.host:='10.1.101.45';
Form1.NMFTP1.port:=21;
Form1.NMFTP1.UserID :='test';
Form1.NMFTP1.Password :='ftptest';
try
Form1.NMFTP1.connect;
except
end;
end;
procedure TForm1.NMFTP1Connect(Sender: TObject);
var
Form1 : TForm1;
begin
try
Form1.nmftp1.Download('test1m.dat' ,'c: est1m.dat' );
except
end;
//Form1.nmftp1.Disconnect;
//Form1.free;
end;
procedure TForm1.NMFTP1ConnectionFailed(Sender: TObject);
var
Form1 : TForm1;
begin
end;
procedure TForm1.NMFTP1PacketRecvd(Sender: TObject);
var
Form1 : TForm1;
begin
end;
end.
此时,执行无误,但如果在TForm1.NMFTP1Connect中把Form1.nmftp1.Disconnect;或Form1.free;加入后,就不传输文件了,但同样的方法在exe程序中却是可以用的.
在此,请教各位,如何把nmftp disconnect掉,并把form 关掉.多谢!