我在下面的代码中遇到了问题,它指的是StoredPathName
。由于Indy 10不使用StoredPathName
,我不确定如何更改此代码以从V9调整到V10。下面的代码不是我自己写的,当谈到这种类型的代码时,我仍然是一个新手,所以我会很感激代码示例,展示如何尽可能地纠正问题。将Delphi Indy v9代码转换为v10
vlist:TStringList;
...
for j:=numEmails downto 1 do
begin
Msg.Clear;
Retrieve(j,Msg);
for k:=0 to Msg.MessageParts.Count-1 do
with Msg.MessageParts[k] do
if Msg.messageParts[k] is TIdAttachmentFile then
begin
//Get the name of the file that was sent.
aname := TIdAttachmentFile(Msg.MessageParts[k]).FileName;
if SameText(aname,ExtractFilename(PacketFilename))
and FileExists(Longfilename(StoredPathName)) then
begin
//Read attachment and do call-back if defined.
vlist.LoadfromFile(LongFilename(StoredPathName));
if assigned(OnReceive) then
OnReceive;
end
end;
end;
Disconnect;
except
on E:Exception do
result := E.Message;
end;
同样的代码,另外一个位是... Connect(9000);
由于9000是不是允许的说法我只是把它改为Connect;
这样可以吗?
在印地如图9所示,参数为'连接()'是'ConnectTimeout'。在Indy 10,这是移动自己的财产。 –