Recent

Author Topic: OpenOffice Automation with Win32 program  (Read 16814 times)

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: OpenOffice Automation with Win32 program
« Reply #15 on: December 08, 2014, 07:04:14 pm »
I'm using the latest development version (trunk). Windows 8.1 shouldn't matter. I'm on Windows 7 and your .exe crashes here too (and I can't imagine the compilation is different on Windows 8.1 and Windows 7). So if your .exe crashes here too it's not the OS.

When compiling try2.lpr in the ide here it is 1.8Mb in size (named project1.exe). On the command prompt with fpc.exe it becomes try2.exe and is 252Kb in size.

I just tried the latest stable version lazarus-1.2.6-fpc-2.6.4-win32 and the project try2 crashed here too. So there is indeed a problem in 1.2.6/2.6.4 which is fixed in trunk. (need to investigate further to actually know what.)

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: OpenOffice Automation with Win32 program
« Reply #16 on: December 08, 2014, 07:24:51 pm »
So it seems to have been resolved in 1.3 but i still have a question...

Why are you using macpas-mode?

When I change your project to {$mode objfpc} (or in the project options) it works correctly here (laz1.2.6/fpc2.6.4).
Is that the case for you also?

I think you would only need macpas-mode if you have ancient mac-pascal code in your project. But your crash is definitely due to the macpas-mode.
« Last Edit: December 08, 2014, 07:29:08 pm by rvk »

aAccord

  • New Member
  • *
  • Posts: 10
Re: OpenOffice Automation with Win32 program
« Reply #17 on: December 08, 2014, 08:38:51 pm »
The macpas decision is above my pay grade ;) , but as I understand it, we still support some older 'classic' Mac systems and use the same code with that development environment. (I don't play in that playground, so I'm fuzzy on the specifics.) So we use the macpas to provide syntax compatibility across dev platforms.

And yes, if I change to objpfc, it doesn't crash.

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: OpenOffice Automation with Win32 program
« Reply #18 on: December 08, 2014, 08:46:04 pm »
You could try putting this specific code into a separate unit with {$mode objfpc} at the top. As long as you compile this with Lazarus it's going to be fine. Your other units can stay the same. You don't need macpas in Lazarus on OSX. You just need macpas for Mac-Pascal code units (for things like return x instead of result etc.). I assume you don't need to compile this code with another pascal compiler. And if you do you could add {$mode objfpc} in conditional defines in that separate unit.

Code: [Select]
unit pasteintoopenoffice;

interface

{$ifdef fpc}
  {$mode objfpc}{$H+}
{$endif}

procedure PasteIntoWordProcessor;

implementation
uses
  Variants, ComObj, ActiveX, Windows;

procedure PasteIntoWordProcessor;
// ... etc
« Last Edit: December 08, 2014, 08:52:10 pm by rvk »

aAccord

  • New Member
  • *
  • Posts: 10
Re: OpenOffice Automation with Win32 program
« Reply #19 on: December 08, 2014, 09:29:34 pm »
Thank you. Yes, we will try putting this into a separate unit compiled with objfpc.

We'll let you know if we run into problems there. We're pretty confident this will behave, so we're going to push our luck and just try it with our main app, not one of these test apps.

I do appreciate the help you and others have given here. I was beginning to question my sanity. Thanks much.

 

TinyPortal © 2005-2018