Solved

turbo delphi 2006 and indy 10 error at compile time

Posted on 2006-10-22
4
1,276 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

623 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