Indy and *.pdf

Giganews Newsgroups
Subject: Indy and *.pdf
Posted by:  duf (d…@wp.pl)
Date: Thu, 25 Sep 2008

When I receive mail with attachment like pdf documents I can not open it, that is I open it but there is no text in documents.
ShellExecute( Handle, "open",(AnsiString( path.c_str() ) + "Komunikaty\Wywoz\" + (*it).c_str()).c_str(), NULL, NULL, NULL );
But when I receive pdf by Outlook there is no problem with this document. I receive attachments in this way:
void __fastcall Thread::POP3()
{
  string dane;

  if ( !Form1->POP3->Connected() )
  {
        try
        {
          Form1->POP3->Connect();
        }
        catch ( const Exception& ) {

          Form1->wsk2->Terminate();
      Form1->wsk2 = NULL;
      return;
        }

    if ( Form1->POP3->Connected() ) Form1->news = Form1->POP3->CheckMessages();
  }
  try
  {
    if( Form1->news > 0 && Form1->POP3->Connected() )
    {
        Form1->news = 0;

        for( int i = 1; i <= Form1->news; ++i )
     {
        Form1->IdMessage1->Clear();
            Form1->POP3->Retrieve( i, Form1->IdMessage1 );

        for( int j = 0; j <= Form1->IdMessage1->MessageParts->Count-1; ++j )
            {
                TIdAttachment *Attachment = dynamic_cast<TIdAttachment*>( Form1->IdMessage1->MessageParts->Items[j] );

                if( Attachment )
         {
            dane = ( Attachment->FileName ).c_str();
                    
                    if ( dane.find( "PWK1", 0, 4 ) != string::npos  && Attachment )
            {
             DeleteFile( AnsiString(Form1->u1_sciezka.c_str()) + "Komunikaty\Wywoz\" + Attachment->FileName );
                        Attachment->SaveToFile( AnsiString(Form1->u1_sciezka.c_str()) + "Komunikaty\Wywoz\" + Attachment->FileName );
                        
                        Form1->Komunikat().push_back( dane ); // vector<string> komunkiat

             Form1->POP3->Delete( i );
            }
                }
            }
        }

    if ( Form1->POP3->Connected() ) Form1->POP3->Disconnect();
    }
    else if ( Form1->POP3->Connected() ) Form1->POP3->Disconnect();
  }
  catch ( const Exception& e ) {

        Form1->news = 0;
        MessageDlg( e.Message, mtWarning , TMsgDlgButtons() << mbOK, 0 );
  }

  Form1->wsk2->Terminate();
  Form1->wsk2 = NULL;
}

Replies