Delphi XE3 crashes when closing Word 2010 [Edit]

After changing from Delphi 6 to XE3 my program crashes when i close a Word-Document opened by the program using OLE-Automation.

So i created a very simple Test-Program with only one Form, a TWordApplication and a TWordDocument (and of course a TButton...).
On ButtonClick i connect to Word and open a document. 
If i close Word or the Document all is working fine.

Then i assigned an eventhandler to WordApplication.OnDocumentBeforeClose.
If i then close the Document my program crashes calling the eventhandler in TWordApplication.InvokeEvent.

Has anyone seen this problem and maybe a solution?

[edit 2013-02-25]
After examining "Params" in TWordApplication.InvokeEvent i found out that the element-order doesn´t match the param-order calling the OnDocumentBeforeClose-Handler. After changing this all is working fine.
So my workaround is to use a modified Word2010.pas in my project.

The problem ist: According to MSDN (http://msdn.microsoft.com/en-us/library/ff834271%28v=office.14%29.aspx) the implementation in the original Word2010.pas is correct!

But what is wrong now, Delphi XE3, MSDN or my Word2010?
[/edit]

Regards, Thomas

Edited by: Thomas Borsdorf on Feb 25, 2013 10:43 AM
0
Thomas
2/25/2013 9:43:46 AM
embarcadero.delphi.ole 598 articles. 1 followers. Follow

1 Replies
1404 Views

Similar Articles

[PageSpeed] 49
Get it on Google Play
Get it on Apple App Store

Hello,

> After changing from Delphi 6 to XE3 my program crashes when i close a 
> Word-Document opened by the program using OLE-Automation.
>
> So i created a very simple Test-Program with only one Form, a 
> TWordApplication and a TWordDocument (and of course a TButton...).
> On ButtonClick i connect to Word and open a document.
> If i close Word or the Document all is working fine.
>
> Then i assigned an eventhandler to WordApplication.OnDocumentBeforeClose.
> If i then close the Document my program crashes calling the eventhandler 
> in TWordApplication.InvokeEvent.
>
> Has anyone seen this problem and maybe a solution?
>
> [edit 2013-02-25]
> After examining "Params" in TWordApplication.InvokeEvent i found out that 
> the element-order doesn´t match the param-order calling the 
> OnDocumentBeforeClose-Handler. After changing this all is working fine.
> So my workaround is to use a modified Word2010.pas in my project.
>
> The problem ist: According to MSDN 
> (http://msdn.microsoft.com/en-us/library/ff834271%28v=office.14%29.aspx) 
> the implementation in the original Word2010.pas is correct!
>
> But what is wrong now, Delphi XE3, MSDN or my Word2010?
>

I suspect you're running into the regression reported here 
http://qc.embarcadero.com/wc/qcmain.aspx?d=109377 and fixed in Update#4 
Hotfix #1. The change was as follows, in case you want to apply it to your 
runtime:

{code}
Index: System.Win.ComObj.pas
===================================================================
--- System.Win.ComObj.pas (revision 54348)
+++ System.Win.ComObj.pas (revision 54349)
@@ -2074,25 +2074,23 @@
   LFistArrItem := Low(LVarArray);
   LLastArrItem := High(LVarArray);

-  // Copy in reverse order
-  for I := LFistArrItem to LLastArrItem do
-  begin
-    LPVarArgIn := @ADispParams.rgvarg[I];
-    LVarArray[LLastArrItem - I] := POleVariant(LPVarArgIn)^;
-  end;
+  if ADispParams.cNamedArgs > 0 then
+    // Copy over data from Params in NamedArgs order
+    for I := LFistArrItem to LLastArrItem do
+    begin
+      LPVarArgIn := @ADispParams.rgvarg[i];
+      LVarArray[ADispParams.rgdispidNamedArgs[i]] := 
POleVariant(LPVarArgIn)^;
+    end
+  else
+    // Copy in reverse order
+    for I := LFistArrItem to LLastArrItem do
+    begin
+      LPVarArgIn := @ADispParams.rgvarg[I];
+      LVarArray[LLastArrItem - I] := POleVariant(LPVarArgIn)^;
+    end;

   Invoker(DispId, LVarArray);

-  // Copy back data passed by reference
-  // NOTE: Not really required as all copies point to same ref.
-  for I := LFistArrItem to LLastArrItem do
-  begin
-    LPVarArgIn := @ADispParams.rgvarg[I];
-    if (LPVarArgIn.vt and varByRef) <> varByRef then
-      Continue;
-    POleVariant(LPVarArgIn)^ := LVarArray[LLastArrItem - I];
-  end;
-
   SetLength(LVarArray, 0);
   Result := S_OK;
 end;
{code}

Cheers,

Bruneau
0
Jean
3/12/2013 6:04:36 PM
Reply:

Similar Artilces:

Delphi 2010 professional to Delphi XE3
Hello, Sorry for this is not right place to ask this question: I have Delphi 2010 professional version, I like to upgrade to Delphi XE3 Am eligible to upgrade or no not? I like answer from Delphi sales team. I couldn’t find email to ask them. Thanks Mike Thomas <> wrote in news:506459@forums.embarcadero.com: > Hello, > > Sorry for this is not right place to ask this question: > I have Delphi 2010 professional version, I like to upgrade to Delphi > XE3 Am eligible to upgrade or no not? I like answer from Delphi > sales team. I couldn’t find emai...

Delphi 2010 and Word 2010 via COM/TypeLibrary and TWordApplication Win32 [Edit]
Hi there, I have a few tools that remotely control Word (v<2007) via TWordApplication that works fine. I downloaded Office 2010 Trial (incl. Word 2010, Excel 2010... To me is only Word 2010 important...) version and used firstly the the built-in wrappers of Delphi (Word2000 and WordXP) because I think I could handle my stuff via the old interfaces. I got an error "interface not supported CLSID {anyGUID...}", when I use e.g. myWordApp.Connect. I tried to import a new Office 2010 TypeLibrary but I couldn't find any? I don't wanna go via .NET or sth.... Is there any ...

Update Delphi 2005 to Delphi 2010, which do i need? [Edit]
Hello, we have one Delphi 2005 Professional here and want to upgrade to Delphi 2010, but we are a bit confused. Our distributor in Germany, ingram-micro offers several upgrade products: UPG DELPHI 2010 PRO - NAMED USER UPG DELPHI 2010 PRO - NAMED USER ELS UPG DELPHI 2010 PRO - NAMED USER FLEX RAD STUDIO 2010 PRO - UPG UPG RAD STUDIO 2010 PRO - NAMED ELC UPG RAD STUDIO 2010 PRO - NAMED FLEX UPG DELPHI 2010 PRO - CONCURRENT ELS UPG DELPHI 2010 PRO - CONCURRENT FLEX What do they mean exactly and which one do i need? At the moment delphi is installed on two PCs and we want to use ...

delphi 2010 memory not released when closing delphi project
each time im runing delphi 2010 the memory that was used was not release after closing a project and the memory don't stop to grow and the browsing for file becoming slow any idea ? Thanks Pierre Auger wrote: > each time im runing delphi 2010 the memory that was used was not > release after closing a project and the memory don't stop to grow and > the browsing for file becoming slow > > any idea ? You are using some 3rd-party components that do not properly release memory in their design-time packages would be my guess. A design-time package stays l...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

Delphi 2010: AV when switching from Default to debug layout and when closing Delphi
Hello, I experience strange AVs in rtl140.bpl when switching from the Default to the Debug Layout (e.g. when starting the application) or when closing Delphi 2010. I have a bunch of Addins (Modelmaker Code Explorer, EurekaLog, DDevExtensions, JCL, etc...), components installed. Any ideas/tools to possibly track down where the culprit is? Possibly simply an addin in combination with docked windows etc. Thanks, Thomas > {quote:title=Thomas Steinmaurer wrote:}{quote} > I experience strange AVs in rtl140.bpl when switching from the Default > to the Debug Layout (...

Delphi 2010 produces much larger binaries than Delphi 2009 [Edit]
When I compile my project with Delphi 2010 the resulting executable is about 30% larger than the one compiled with Delphi 2009. Both binaries are compiled with the same source code and project options. The size of individual DCU files increases by 5-20%. Has anybody experienced similar results? Has anybody an idea what could cause this? It surprises me, as the changes in syntax and VCL have not been that big. Best regards, Joachim Edited by: Joachim Marder on Sep 25, 2009 6:07 AM "Joachim Marder" wrote in message news:166152@forums.codegear.com... > When I compi...

OLE Automation with Delphi and MS Word [Edit]
Hi, I'm working with Delphi for a while now, but it's the first time that I need to export in Word some data taken from a sqlite database. With SQLite there are no problems, everything works as it should. With Word, also because of the lack of good part of documentation, I'm currently having troubles, in particular, in the moment when i go to split a cell of a table, depending on the number of occurrences found with a SQLite query (1 occurrence = do nothing, 2 occurrences = split the cell into two rows, 15 occurrences = split the cell into 15 rows and so on). When i create ...

Delphi XE3 slow form closing [Edit]
I upgraded to XE3 some time ago. Recently I noticed that there is significant delay between clicking on "Close" button of any form in my app and the moment when the form is really closed/destroyed. On closing the form gets repainted and the application freezes until the form is destroyed. The time this takes is long (3 - 5 seconds) and it is very annoying. The problem occurs in all scenarios: inside and outside Delphi IDE for debug and release builds. I notice the same problem happening to Delphi IDE forms (for example Help->About). I am virus free (according to 2 different sca...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi XE3 plus CBuilder XE3 demo is still Delphi only
Have Delphi XE3 installed (and registered), tried to install the CBuilder XE3 demo to see if it work as required. The result is that only Delphi was updated and no CBuilder available. Is there a way to test it - I would have upgraded to full RadStudio but doubted the CBuilder 64 bit compiler would be available in time (deadline is almost here and already ported the code to VC++ but don't particularly like it). ...

Price of upgrade from Delphi 2010 Professional to Delphi 2010 Enterprise?
It's weird, but I could not find the answer on so simple question not in Embarcadero Shop, neither by the forum search. For example, the shop info about Enterprise upgrade says: The Upgrade product is available to registered owners of 2006-2009 versions, blah-blah... So, if I'm Delphi 2010 Professional user, I even not eligible for upgrade? I have to buy a new version of Enterprise??? But if I'm Delphi 2006 Professional user, I can upgrade. Please clarify this nonsense for me. Exact question is in the subject. Thanks! Hi Dmitri, > It's weird, but I could not...

Web resources about - Delphi XE3 crashes when closing Word 2010 [Edit] - embarcadero.delphi.ole

Lightning Crashes - Wikipedia, the free encyclopedia
" Lightning Crashes " is a song by the rock band Live , from their 1994 album, Throwing Copper . The track wasn't released as a single in the ...

When New York Times website crashes, newspaper turns to Facebook Notes
When The New York Times’ website suffered some downtime Wednesday because of technical issues, the newspaper turned to Facebook Notes to post ...


2013 Drive4COPD Nationwide Kyle Larson crashes into fence - YouTube
A difficult end to an amazing race at Daytona International Speedway. During Saturday's Nationwide race, Kyle Larson gets airborne with several ...

Facebook crashes in rare global outage
Users in the UAE were unable to access Facebook after it crashed just after midday on Thursday.

Nice Save of the Day: Guy Catches Drone Before It Crashes Into Pond
This man is a hero to drones across the globe. He took his new DJI Phantom 2 out for a spin and was having a great time… until the batteries ...

Man crashes car doing burnouts allegedly twice over limit at Port Pirie - AdelaideNow Search Search
A MAN was arrested after allegedly doing burnouts while almost two times over the limit and crashing into a fence at Port Pirie.

Kangaroos cause two crashes near Bendigo
One driver swerved, the other collided with a kangaroo in separate accidents near Bendigo.

Woman thrown out of bed after car crashes through bedroom window
A 46-year-old Green Valley&nbsp;woman was woken up with a bang and thrown out of bed early on Wednesday morning&nbsp;when a car crashed through ...

Truck crashes into beam entering Westfield Belconnen car park
A truck has crashed into an overhead beam trying to enter a Westfield Belconnen car park.

Resources last updated: 12/10/2015 5:33:37 PM