掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
XE2標準搭載のIndy10で添付ファイルを保存するには? (ID:41525)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Mr.XRAYさんありがとうございます。 探してみたところ、そのファイルはCBuilderXE2に入っていました。 しかし、今度は「system.Classes.pas」というファイルが必要だと、 コンパイラから怒られました。 そこでそのファイルを探してみたのですが、PC上にありませんでした。 コードの書き方が間違っているのでしょうか? 以下がサイトを参考にしながら書いてみたコードです。 void __fastcall TForm1::Button3Click(TObject *Sender) { //メールを受信する UnicodeString AFileName = "d:\\aaa.txt"; TIdMessage* msg = new TIdMessage(NULL); TIdEMailAddressItem* item = msg->Recipients->Add(); TIdAttachmentFile* attached = new TIdAttachmentFile( msg->MessageParts, msg->MessageParts->Items[1]->FileName); //ファイルのパス bool result = IdPOP31->Retrieve(5049, msg); //メールの番号は1から if (result) { StringGrid1->Cells[1][1] = msg->Subject; StringGrid1->Cells[2][1] = msg->Body->Text; StringGrid1->Cells[3][1] = msg->Date; StringGrid1->Cells[4][1] = msg->From->Text; StringGrid1->Cells[5][1] = item->Address; StringGrid1->Cells[6][1] = msg->Headers->Text; int i = 1; while ("" != msg->MessageParts->Items[i]->FileName) { try { StringGrid1->Cells[7][1] = StringGrid1->Cells[7][1] + msg->MessageParts->Items[i]->FileName; //↓この部分が自分が書いた部分で、最も怪しい部分です。 attached->SaveToFile(AFileName); } catch (int) { } } } else { MessageDlg("メールの受信に失敗しました。", mtError, TMsgDlgButtons() << mbOK, 0); } }
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.