我在使用下面引用的代码时遇到问题StoredPathName
。由于 Indy 10 不使用StoredPathName
,我不确定如何更改此代码以从 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;
Is that OK?