bgarrels / la-pe

Automatically exported from code.google.com/p/la-pe
0 stars 0 forks source link

todo: OLE #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
//
// file: main.pas
//
uses
  {+}
  {$IFDEF MSWINDOWS}Windows,{$ENDIF}
  {+.}
...
  ,StrUtils
  {$IFDEF COM}
  ,ComObj {$IFDEF FPC},Ole2{$ENDIF}, ActiveX
  {$ENDIF COM}
;
...

{$IFDEF COM}
function CreateOLEObject(const ClassName: string): Variant;
begin
  Result := CreateOLEObject(ClassName);
end;
{$ENDIF COM}
...
procedure TForm1.FormCreate(Sender: TObject);
begin
  CoInitializeEx(nil, 0);
end;
...
procedure Compile(Run, Disassemble: Boolean);
...
      Compiler.addGlobalFunc('function CreateOLEObject(const ClassName: string): Variant;', @CreateOLEObject);

//
// file: test\ole.lap
//
var
  s: string;
  xmlDoc: Variant;
begin
  s := 'MSXML2.DOMDocument';
  WriteLn('com(1):', s);
  xmlDoc := VarCreateOLEObject('MSXML2.DOMDocument');
  xmlDoc.validateOnParse := True; // *** LINE 8 ***
  xmlDoc.async := False;
  xmlDoc := Null;
  WriteLn('com(1)!', s);
end;

//
// error:
//
Compilation error: "Operator "Dot" not compatible with types "Variant" and 
"AnsiString" at line 8, column 9"

Original issue reported on code.google.com by pult....@gmail.com on 19 Sep 2011 at 6:59

GoogleCodeExporter commented 9 years ago
Thanks for reporting. Will do in due time, but currently does not have a high 
priority.

Original comment by niels....@gmail.com on 21 Sep 2011 at 1:08

GoogleCodeExporter commented 9 years ago
Issue 28 has been merged into this issue.

Original comment by niels....@gmail.com on 15 Sep 2013 at 5:15