Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

todo: OLE #6

Open
GoogleCodeExporter opened this issue Mar 21, 2015 · 2 comments
Open

todo: OLE #6

GoogleCodeExporter opened this issue Mar 21, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

//
// 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 [email protected] on 19 Sep 2011 at 6:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants