Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

turbo delphi 2006 and indy 10 error at compile time

Posted on 2006-10-22
4
Medium Priority
?
1,291 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

721 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