我在下面的代碼中遇到了問題,它指的是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,這是移動自己的財產。 –