Archived Forum Post

Index of archived forum posts

Question:

Problem with 9.5.0 ActiveX version in Delphi

Apr 22 '14 at 02:44

I try to use version 9.5.0 in Delphi 2010.
When I send email I get error:
Type : EIntfCastError
Message : Interface not supported.

mailman := TChilkatMailMan.Create(Self);
email := TChilkatEmail.Create(Self);
success := mailman.SendEmail(email As IChilkatEmail); //error here: Interface not supported

Has anyone can help?


Answer

Change the call to SendEmail to look like this instead:

success := mailman.SendEmail(email.ControlInterface);


Answer

The IChilkatEmail interface should be present. I have verified it.

Note: The single-DLL ActiveX uses "IChilkatEmail", whereas the deprecated multiple DLL ActiveX's use "IChilkatEmail2".

Follow these steps carefully:

  1. Download the very latest (v9.5.0.33) single-DLL ActiveX from here: http://www.chilkatsoft.com/downloads_ActiveX.asp
  2. Register the DLL. Given that you are using an older version of Delphi, it would be the 32-bit DLL that is required.
  3. Import the ActiveX DLL in Delphi so that the Chilkat_v9_5_0_TLB.pas and Chilkat_v9_5_0_TLB.dcr are created.
  4. You can verify that IChilkatEmail exists by opening Chilkat_v9_5_0_TLB.pas in a text editor. For example:
function TChilkatMailMan.FetchEmail(const uidl: WideString): IChilkatEmail;
begin
  Result := DefaultInterface.FetchEmail(uidl);
end;
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_v9_5_0_TLB;
    

Answer

I verified Chilkat_v9_5_0_TLB and IChilkatEmail Exists.
ActiveX works properly from VB script but not from Delphi.
"Interface not supported" is displayed.
I tested it on second computer with Delphi 2010 with the same result.

I would add that the code compiles. Error appears at runtime.


Answer

Thank you. This solution works. Please update examples for Delphi.