Solved

turbo delphi 2006 and indy 10 error at compile time

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange behavior when a form is closed 6 69
Dev Express grid collapse 2 47
select query - oracle 16 101
Breakpoint doesn't stop in my variable 3 38
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

726 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