var
FTP : TNMFTP;
implementation
....Procedure CreateFTP;
begin
if ??? then FTP := TNMFTP.Create(Nil);
end;???处怎么写才能让程序实现:如果已经执行过FTP := TNMFTP.Create(Nil);就不执行了,如果没有执行过,就执行Create.
FTP : TNMFTP;
implementation
....Procedure CreateFTP;
begin
if ??? then FTP := TNMFTP.Create(Nil);
end;???处怎么写才能让程序实现:如果已经执行过FTP := TNMFTP.Create(Nil);就不执行了,如果没有执行过,就执行Create.
FTP := TNMFTP.Create(Nil);
i:= i+1;
destroy时, i:= i-1;
FTP : TNMFTP;
implementation
....Procedure CreateFTP;
begin
if not assigned(ftp) then FTP := TNMFTP.Create(Nil);////////
end;
initialization
FTP:=nil;///////
这样的话
procedure FreeFTP;
begin
FTP.Free;
还得加一句:
FTP := Nil;
end;
还得加一句:
FTP := Nil;
--->
FreeAndNil(FTP);
if not assigned(tt) then
Try
tt := TClass.Create(nil)
finally
tt.Free;
end;
//FTP没有Create
或FTP.Free;
FTP:=nil;
同意 blazingfire(烈焰)
if FTP = Nil then FTP := TClass.Create(Application);FreeAndNil(FTP);