[Lazarus] Code generates an error after upgraded to FPC 3.2.2

Jamal Gabra jamal.gabra at gmail.com
Tue Nov 16 12:27:29 CET 2021


Hello all,

I just found out that something has changed from FPC 3.2.0 to FPC 3.2.2
that is starting to cause error in a simple app I developed to send emails
through MS Outlook.

I use Lazarus v2.2.0RC2 and FPC3.2.2.

I use OLEVariant, and I believe the changes have taken place in the
unit ComObj, but I could be wrong.

PS:I do not own this code.

Snippet code:

uses comobj, variants;

...

procedure TForm1.SendBtnClick(Sender: TObject);
const
  olMailItem = 0;
  olByValue = 1;
var
  MailItem: OLEVariant;
  podatak: OLEVariant;
begin
  try
    Outlook := GetActiveOleObject('Outlook.Application');
  except
    Outlook := CreateOleObject('Outlook.Application');
  end;

  namespace := Outlook.GetNamespace('MAPI');
  namespace.logon;

  MailItem := Outlook.CreateItem(olMailItem);
  podatak := 'test at test.com';
  MailItem.Recipients.Add(podatak);
  MailItem.Recipients.ResolveAll;
  podatak := 'Subject';
  MailItem.Subject := podatak;
  podatak := 'Body Msg';
  MailItem.Body := podatak;

  MailItem.Display;//send

  Outlook := Unassigned;
end;

This code last worked fine while on FPC 3.2.0 but when upgraded it started
erroring at the line:
MailItem*.Subject* := podatak;

Appreciate if someone can assist in pointing out something (the above code
or the FPC code :)

Not sure if this is the right place to report this but will start here.

Thank you...

Jamal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20211116/8e943c28/attachment.html>


More information about the lazarus mailing list