^_^,borland新闻组回答我的问题了!!!!!!,

freeia 2003-08-20 02:12:02
回答得真详细,CSDN的大虾们要学习别人回答问题的风格啊!
"freeia" <freeia@163.com> wrote in message
news:3f42c690$1@newsgroups.borland.com...

> TIdMessage *pCurrentMsg = new TIdMessage; // it doesn't work!:(

TIdMessage is a component. Just like any other VCL component, TIdMessage's
constructor expects a TComponent parameter to specify its Owner.

> AnsiString strAttachmentFileName =
strAccountProfileDir + "\\" + pCurrentMsg->MessageParts->Items[j]->FileName;
>
pCurrentMsg->MessageParts->Items[j]->SaveToFile(strAttachmentFileName);

FileName and SaveToFile() are not members of TIdMessagePart. You need to
cast to TIdAttachment first.

Try this instead:

TIdMessage *pCurrentMsg = new TIdMessage(NULL);
try
{
if( IdPOP3->Retrieve(i, pCurrentMsg) )
{
for(int j=0; j < pCurrentMsg->MessageParts->Count; ++j )
{
TIdAttachment *attachment =
dynamic_cast<TIdAttachment*>(pCurrentMsg->MessageParts->Items[j]);
if( attachment )
attachment->SaveToFile(strAccountProfileDir + "\\" +
attachment->FileName);
}
}
}
__finally {
delete pCurrentMsg;
}


Gambit
...全文
29 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
chifengwatch 2003-08-20
  • 打赏
  • 举报
回复
学习
lvjack 2003-08-20
  • 打赏
  • 举报
回复
borland的新闻组什么地址啊?
俺也去学习学习
domustdo 2003-08-20
  • 打赏
  • 举报
回复
indy的新闻组一向都很不错。
Siney 2003-08-20
  • 打赏
  • 举报
回复
哈哈,又是gambit,你的回答一向严禁认真,还有remy

552

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 茶馆
社区管理员
  • 茶馆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧