Using cxGrid inside an Excel Task Pane

Add-in Express™ Support Service
That's what is more important than anything else

Using cxGrid inside an Excel Task Pane
Gives access violation as soon as you add a column 
Richard Stevens




Posts: 43
Joined: 2007-01-24
Hi - I wonder if anybody else can confirm the same issue I'm having.

Using Delphi XE, latest AddInExpress (December 2012 release, premium) and latest DevExpress (12.2.2) I am trying to use a cxGrid on a task pane in an Excel Addin.

If I just drop the cxGrid on its own, all is fine. But obviously it's of no value until I can add some columns - and as soon as I do that the application bombs out (message below).

This is with Office 2010. I get the same problem with Office 2003 and earlier versions of DevExpress and ADX in Delphi XE, but no problems with Delphi 7.

It's quite easy to replicate on any new addin, just do an Excel app with a single enabled task pane, and add a cxGrid to the pane. It will look fine. Then add a column to the grid and try it again - it will error.

Log is:


Exceptions:
============
ADX Extensions error (TadxExcelTaskPane.CreateEx): the add-in has fired an exception.
Access violation at address 07C67119 in module 'BOEExcelToPDS.dll'. Read of address 00000000

System Info:
============
Time: 01/01/2013 12:36:55
Package: Unknown
ADX Version:7.1.1211
ADX Extensions Version 7.0.1210
Excel version: 14.0
* Addin 1:1 BOEDashboard.BOE_Excel_Dashboard
BOE Excel to PDS

Log:
============
01/01/2013 12:37:13 2652 Show time: 01/01/2013 12:37:13
01/01/2013 12:37:09 2652 |-------------------------
01/01/2013 12:37:09 2652 |ADX Extensions error (TadxExcelTaskPane.CreateEx): the add-in has fired an exception.
Access violation at address 07C67119 in module 'BOEExcelToPDS.dll'. Read of address 00000000
01/01/2013 12:37:09 2652 |Exception time: 01/01/2013 12:37:09
01/01/2013 12:37:09 2652 |=========================
01/01/2013 12:37:09 2652 TadxForm.Create: Before inherited TForm.Create(AOwner)
01/01/2013 12:37:09 2652 TadxXlForm.CreateEx
01/01/2013 12:37:09 2652 GetForm
01/01/2013 12:37:09 2652 TadxXlFormsCollectionItem.CreateFormInstance
01/01/2013 12:37:09 2652 TadxXlFormsCollectionItem.DeleteAllForms 0
01/01/2013 12:36:55 2652 TadxExcelTaskPanesManager.DoAddInStartupComplete
01/01/2013 12:36:55 2652 Event: OnAddInStartupComplete
01/01/2013 12:36:55 2652 not PropertiesIsSetToShowUpForm
01/01/2013 12:36:55 2652 DoShowForm
01/01/2013 12:36:55 2652 TadxXLHook.CreateEx
01/01/2013 12:36:55 2652 TadxReceiverWindow.AddReceiverCustomMessage(TRegionCloseButtonClickMessage)1
01/01/2013 12:36:55 2652 AddCloseButtonClickMessageToReceiver
01/01/2013 12:36:55 2652 TadxExcelTaskPanesManager.DoAddInInitialize
01/01/2013 12:36:55 2652 Event: OnAddInInitialize
01/01/2013 12:36:55 2652 TadxXlFormsCollectionItem.DeleteAllForms 0
01/01/2013 12:36:55 2652 TadxXlFormsCollectionItem.DeleteAllForms 0
01/01/2013 12:36:55 2652 ADXXlFormsCollectionItem.SetFormClassName
01/01/2013 12:36:55 2652 TadxXlFormsCollectionItem.FormsHideShow
01/01/2013 12:36:55 2652 TadxExcelTaskPanesManager.Create


Regards
Richard
Posted 01 Jan, 2013 09:28:58 Top
Andrei Smolin


Add-in Express team


Posts: 14977
Joined: 2006-05-11
Hello Richard,

Below is what a customer reported about an issue with cxGrid:

===
There is no code executing when I scroll. I found out what caused the problem. It is the column HeaderGlyph. If I clear it, the add-in works fine on Windows 7. Otherwise it gives the AV error.
===

Can you please check if the above info applies to your case as well?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Jan, 2013 07:03:30 Top
Richard Stevens




Posts: 43
Joined: 2007-01-24
Thanks for the reply Andrei.

I have no headerglyph set for any column.

When I first add the grid, all is fine.

As soon as I add a column - even if I don't set a single property, or connect it to a field - it will AV.

Regards
Richard
Posted 02 Jan, 2013 17:39:09 Top
Andrei Smolin


Add-in Express team


Posts: 14977
Joined: 2006-05-11
Richard,

Pleasy try to modify your add-in as shown below:

initialization
  TadxFactory.Create(ComServer, TADX_Outlook, CLASS_ADX_Outlook, TAddInModule);
  // init
  dxInitializeGDIPlus(); // uses dxGDIPlusAPI !

finalization
  // unload
  dxFinalizeGDIPlus();


If this doesn't help, I suggest that you contact the DevExpress team.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Jan, 2013 04:14:36 Top
Richard Stevens




Posts: 43
Joined: 2007-01-24
Andrei, thank you very much, that has indeed fixed the problem.

For future reference, the commands have changed slightly, as per this DevExpress entry:

http://www.devexpress.com/Support/Center/p/B199204.aspx

(Add "dxCore" to your uses clause, then use dxInitialize and dxFinalize)

Regards, and thank you again
Richard
Posted 03 Jan, 2013 08:10:05 Top
Andrei Smolin


Add-in Express team


Posts: 14977
Joined: 2006-05-11
Great! Thank you for sharing the actual solution!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Jan, 2013 08:39:37 Top