掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
XE2標準搭載のIndy10で添付ファイルを保存するには? (ID:41529)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>Mr.XRAYさん ご指摘ありがとうございます、原因のひとつが判りました。 プロジェクトファイルが壊れていました(笑)。 それに気づかず、Builderを3回ほどクリーンインストールしてしまいました・・・。 Indy10を無理やり古いバージョンと交換したところ、BuilderのIndyが再インストール不能となり、 またインストール、それでもIndyが正常に認識されず、駄目元でプロジェクトを新規作成してみたら、 あっさりと動きました^^;。 system.Classesというのは、Builderのプロジェクトファイルの一番先頭に記述されていて、 Indy10使用時にエラーを起こすと、そのメッセージが出るみたいです。 バグをつぶしていったところ、そのエラーは出なくなりました。 お騒がせしました^^;。 >山本隆さん ありがとうございます!!m(__)m サイト参考にさせてもらっています。 DelphiからC++Builderに移ってまだ日が浅いので、大変参考になります。 早速実装したところ、きれいに動きました(!) C++で組むのを諦めて、Delphiで組みなおしている最中でした。 助かりました、皆さん本当にありがとうございますm(__)m。 以下、完成したメール読み込み部です。 折角Delphiでも作ったので、(自身の勉強の為にも)後ほどDelphiで組んだものも載せておきます。 環境 WinXP C++BuilderXE2スターター メール読み込み部分 void __fastcall TForm1::Button3Click(TObject *Sender) { chekcount = IdPOP31->CheckMessages(); Button5Click(Sender); //メールを受信する TIdMessage* msg = new TIdMessage(NULL); TIdEMailAddressItem* item = msg->Recipients->Add(); //int i1 = 1; //1件だけ試し受信 int mailcount = 1; int message = 2;//IdPOP31->CheckMessages(); StringGrid1->RowCount = IdPOP31->CheckMessages(); while (message > mailcount) { bool result = IdPOP31->Retrieve(5049, msg); //メールの番号は1から if (result) { StringGrid1->Cells[1][mailcount] = msg->Subject; StringGrid1->Cells[2][mailcount] = msg->Body->Text; StringGrid1->Cells[3][mailcount] = msg->Date; StringGrid1->Cells[4][mailcount] = msg->From->Text; int Ritems = 0; int Rcount = msg->Recipients->Count; while ( Ritems < Rcount + 1) { StringGrid1->Cells[5][mailcount] = StringGrid1->Cells[5][mailcount] + msg->Recipients->Items[Ritems]->Text + char(13); Ritems += 1; if (Ritems == Rcount) { Ritems += 2; } } StringGrid1->Cells[6][mailcount] = msg->Headers->Text; for (int i = 0; i < msg->MessageParts->Count; ++i) { TIdMessagePart* part = msg->MessageParts->Items[i]; if (part->PartType() == mptAttachment) { TIdAttachmentFile* attached = dynamic_cast<TIdAttachmentFile*>(part); if (attached != 0) { //TODO:ファイル名はデコードする必要がある StringGrid1->Cells[7][mailcount] = StringGrid1->Cells[7][mailcount] + attached->FileName; attached->SaveToFile("d:\\" + attached->FileName); } } }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.