Starting OO via Automation on Windows is not difficult. Here's an
example in Delphi that starts OO and opens a new document. This code
crashes with FPC.


program TestOO;

uses
  SysUtils, Variants, ComObj;

const
  OOServerName = 'com.sun.star.ServiceManager';
var
  Server       : Variant;
  Desktop      : Variant;
  LoadParams   : Variant;
  Document     : Variant;
begin
  if Assigned(InitProc) then
    TProcedure(InitProc);

  try
    Server := CreateOleObject(OOServerName);
  except
    WriteLn('Unable to start OO.');
    Exit;
  end;

  Desktop := Server.CreateInstance('com.sun.star.frame.Desktop');

  LoadParams := VarArrayCreate([0, -1], varVariant);

   {Create new document}
  Document := Desktop.LoadComponentFromURL('private:factory/swriter',
                                           '_blank', 0, LoadParams);
end.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to