Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2021-11

Code generates an error after upgraded to FPC 3.2.2

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jamal Gabra

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 := ';
  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>

Reply by email