Invalid parent window adding custom task panes

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

Invalid parent window adding custom task panes
 
Miguel Domingues




Posts: 6
Joined: 2010-11-10
Hello,

In Windows Explorer if you activate the preview pane you can select an Excel file and see the file content in preview mode. If you check the processes there is an EXCEL.EXE that is doing the job, but with the UI within the preview pane. The problem is that we have customs panes in our add-in that raises the following exception:

System.ArgumentException: Invalid parent window specified.
at System.RuntimeType.ForwardCallToInvokeMember(Stri ng memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at AddinExpress.MSO.ICTPFactory.CreateCTP(Stri ng CTPAxID, String CTPTitle, Object CTPParentWindow)
at AddinExpress.MSO.ADXAddinModule.AddCustomTaskPanes(Object parent, String outlookFolderName)

If I comment out the following code the exception is not occurring (as expected!):

public AddinModule()
{
...
this.TaskPanes.Add(this.adxTaskSearch);
...
}

Can you give some tips?
Thanks.
Posted 23 Oct, 2012 10:13:41 Top
Andrei Smolin


Add-in Express team


Posts: 17438
Joined: 2006-05-11
Hello Miguel,

I cannot reproduce this issue on Windows 7 SP1 64bit + Excel 2010 SP1 32 bit. I suppose the issue is caused by the code of your task pane. Can you please check if the same behavior is reproduced with an empty custom task pane?

If this is caused by your pane, I suggest that you check ExcelApp.UserControl:

if (ExcelApp.UserControl) 
    System.Diagnostics.Debug.Print("UserControl is true");
else
    System.Diagnostics.Debug.Print("UserControl is false");


If ExcelApp.UserControlis true then Excel is started by the user. If it is false, then Excel is started via Automation. In the latter case, you need to disable the functionality of your custom task pane.

BTW, I suppose your CTP will also fire exceptions if a user refreshes an Excel worksheet embedded into an Office document.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Oct, 2012 11:23:03 Top
Miguel Domingues




Posts: 6
Joined: 2010-11-10
Hello,

With an empty task panel (Primavera.Office.Extensions.DiagnosticsControl) the problem still occurs.

The tip about the "ExcelApp.UserControl" is great but i still have an issue to solve: when Excel is started via automation i don't load the panels and the explorer preview works fine; but if the user click on the Excel file the system reuses the existent instance of Excel application to open the file and then i don't have the panels loaded!

This is my current task panel component initialization:


this.adxTaskDiagnostics.ControlProgID = "Primavera.Office.Extensions.DiagnosticsControl";
this.adxTaskDiagnostics.DockPosition = AddinExpress.MSO.ADXCTPDockPosition.ctpDockPositionBottom;
this.adxTaskDiagnostics.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaExcel;
resources.ApplyResources(this.adxTaskDiagnostics, "adxTaskDiagnostics");
this.adxTaskDiagnostics.Visible = false;


I'm also working on Windows 7 SP1 64bit + Excel 2010 (14.0.6117.5003) 32 bit. And yes, it also fires exceptions if a user inserts an Excel worksheet embedded into an Office document.

Thanks.
Posted 24 Oct, 2012 09:47:27 Top
Andrei Smolin


Add-in Express team


Posts: 17438
Joined: 2006-05-11
Miguel Domingues writes:
if the user click on the Excel file the system reuses the existent instance of Excel application to open the file and then i don't have the panels loaded!


This is a bug in Excel, see Excel 2010 + COM add-in + Windows 7 preview pane = issue? at http://social.msdn.microsoft.com/Forums/en-US/exceldev/thread/fb72e113-c65c-4d79-8188-d3bb548939cc/

Miguel Domingues writes:
And yes, it also fires exceptions if a user inserts an Excel worksheet embedded into an Office document.


How can I reproduce these?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 24 Oct, 2012 11:37:16 Top