Solved

turbo delphi 2006 and indy 10 error at compile time

Posted on 2006-10-22
4
1,244 Views
Last Modified: 2008-03-17
I am migrating from Delphi 7 with indy 9 to Turbo Delphi 2006 with Indy 10
I get now errors that I didn't have with Delphi 7
I had code like this to attach 3 files to the an email message I prepared
 
M := TIDMessage.Create(Application);
 with M do
  begin
     .../...
     TIDAttachment.Create(MessageParts,File1);
     TIDAttachment.Create(MessageParts,File2);
      .../...
  end  ;

Now I get errors on the TIDAttachment.Create (it is the french version, I translate) :

[Pascal Warning] U0116a.pas(282): W1020 Instance constructor of 'TIdAttachment' containing abstract method 'TIdAttachment.OpenLoadStream'
[Pascal Erreur] U0116a.pas(283): E2034 Too many parameters

Surely something has changed in Indy, but how should I code this now ???
0
Comment
Question by:LeTay
  • 2
4 Comments
 
LVL 28

Expert Comment

by:TName
ID: 17783716
I think you either have to do this:
 MyIDAttachment:=TIDAttachment.Create(MessageParts);
 MyIDAttachment.FileName:='SomeFile.txt';

or
uses IDAttachmentFile;
...
MyIDAttachmentFile:=TIDAttachmentFile.Create(MessageParts, AFileName);

http://support.borland.com/entry.jspa?categoryID=148&externalID=4651

 
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 17787395
Several things have changed in Indy and as a result, it's not backwards-compatible with previous versions. And yes, that sucks! So if you have more code that relies on Indy then first get familiar with the new Indy components.
0
 

Author Comment

by:LeTay
ID: 17787568
Hello TName,
I will try what you suggest
But how can I put several (unknow number at compile time) attachments then ?
0
 
LVL 28

Accepted Solution

by:
TName earned 500 total points
ID: 17788083
Haven't tried it, but basically you should replace TIDAttachment with TIDAttachmentFile. There are some differences though, have a look at this:

http://72.14.221.104/search?q=cache:WDiMSiMTTsMJ:www.indyproject.org/Sockets/Blogs/RLebeau/2005_08_17_A.iwp

Example from the link above:

    with TIdAttachmentFile.Create(IdMessage1.MessageParts, 'c:\folder\image1.jpg') do begin
      ContentID := '12345';
      ContentType := 'image/jpeg';
      FileName := 'image1.jpg';
    end;

    with TIdAttachmentFile.Create(IdMessage1.MessageParts, 'c:\folder\image2.jpg') do begin
      ContentID := '56789';
      ContentType := 'image/jpeg';
      FileName := 'image2.jpg';
    end;

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now