I am in the transition of an old Delphi 6 application to Delphi 10 Tokyo. This code run without any problem in Delphi 6 but gives an error in Delphi XE2 or Delphi 10 Tokyo:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, COMObj;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Mosaikserver: variant;
SystemDB: widestring;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Mosaikserver := CreateOleObject('mosaik.server');
SystemDB := 'C:\xxx\system.mdw';
Mosaikserver.SystemDB := SystemDB;
end;
end.
In Delphi XE2 or Delphi 10 Tokyo, I receive a floating point divide by zero on the line: Mosaikserver.SystemDB := SystemDB;
Also Mosaikserver.SystemDB := 'c:\xxx\system.mdw';
gives the same error.
I guess this has something to do with Unicode strings but I don't know what exactly.
Any advice?