Error HRESULT E_FAIL has been returned from a call to a COM component

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

Error HRESULT E_FAIL has been returned from a call to a COM component
 
chris chen




Posts: 2
Joined: 2022-03-15
Hi,

I compiled and run MyAddin183( download from MyAddin183.zip in post Insert webbrowser within slide with C# ), but can not run successfully and get error:
Detailed technical information follows: 
---
(Inner Exception)
Date and Time:         9/16/2022 12:10:53 PM
Machine Name:          WIN-NSDPPJFFCCI
IP Address:            fe80::592e:5861:2b94:ad8e%11
Current User:          WIN-NSDPPJFFCCIchenchao

Application Domain:    C:UserschenchaoDesktopMyAddin183_orgMyAddin183MyAddin183inDebug
Assembly Codebase:     file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Interop.PowerPoint/15.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.PowerPoint.dll
Assembly Full Name:    Microsoft.Office.Interop.PowerPoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
Assembly Version:      15.0.0.0

Exception Source:      Microsoft.Office.Interop.PowerPoint
Exception Type:        System.Runtime.InteropServices.COMException
Exception Message:     Error HRESULT E_FAIL has been returned from a call to a COM component.
Exception Target Site: AddOLEObject

---- Stack Trace ----
   Microsoft.Office.Interop.PowerPoint.Shapes.AddOLEObject(Left As Single, Top As Single, Width As Single, Height As Single, ClassName As String, FileName As String, DisplayAsIcon As MsoTriState, IconFileName As String, IconIndex As Int32, IconLabel As String, Link As MsoTriState)
       Microsoft.Office.Interop.PowerPoint.dll: N 00000 (0x0) JIT 
   MyAddin183.AddinModule.adxRibbonButton1_OnClick(sender As Object, control As IRibbonControl, pressed As Boolean)
       AddinModule.cs: line 0161, col 13, IL 0028 (0x1C)
   AddinExpress.MSO.ADXRibbonButton.DoInternalAction(e As ADXRibbonOnActionEventArgs)
       Microsoft.Office.Interop.PowerPoint.dll: N 0035 (0x23) IL 



(Outer Exception)
Date and Time:         9/16/2022 12:10:53 PM
Machine Name:          WIN-NSDPPJFFCCI
IP Address:            fe80::592e:5861:2b94:ad8e%11
Current User:          WIN-NSDPPJFFCCIchenchao

Application Domain:    C:UserschenchaoDesktopMyAddin183_orgMyAddin183MyAddin183inDebug
Assembly Codebase:     file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/AddinExpress.MSO.2005/v4.0_10.1.4703.0__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name:    AddinExpress.MSO.2005, Version=10.1.4703.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version:      10.1.4703.0

Exception Source:      
Exception Type:        AddinExpress.MSO.ADXExternalException
Exception Message:     An error has occurred in the code of the add-in.

---- Stack Trace ----




My Development Environment is:

Microsoft Visual Studio Professional 2019
Version 16.11.19
VisualStudio.16.Release/16.11.19+32901.82
Microsoft .NET Framework
Version 4.7.03062

Installed Version: Professional

Visual C++ 2019   00435-60000-00000-AA231
Microsoft Visual C++ 2019

Add-in Express for Microsoft Office and .NET   v10.1.4703
Add-in Express for Microsoft Office and .NET. For more information about Add-in Expressô, see the following website: http://www.add-in-express.com. (C) Add-in Express Ltd. All rights reserved.

ASP.NET and Web Tools 2019   16.11.110.1451
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0   16.11.110.1451
Azure App Service Tools v3.0.0

C# Tools   3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   16.11.21196.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Node.js Tools   1.5.30526.3 Commit Hash:c09c81113bcbc86d57943fcdd67e82434263d61d
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   5.11.2
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Python   16.11.21196.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Profiling support   16.11.21196.2
Profiling support for Python projects.

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.11.0-beta.21514.6+b6c2c4f53ea3a08fa603ea93d6d2f808a62a21d1
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

OS Name	Microsoft Windows 7 Ultimate
Version	6.1.7601 Service Pack 1 Build 7601


Could you please help me with this issue?
Thanks a lot.
Posted 15 Sep, 2022 23:35:29 Top
Andrei Smolin


Add-in Express team


Posts: 18420
Joined: 2006-05-11
Hello Chris,

We already talked about this issue with that project. Here's my response; see my email sent on 5-Jan-2022; the subject is "RE: Add-in Express.com feedback: Is it possible to develop COM Add-ins to support embedding WebViewer in PowerPoint {ID:431131547}"

I reproduce the issue. I suppose it relates to Microsoft switching from Internet Explorer to Chromium. But, in fact, I donít know what causes it.
Iíve checked whether this approach works at all. Iíve replaced "Shell.Explorer.2" with "Forms.CommandButton.1" (this is also demonstrated at https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shapes.addoleobject) and found it working: this puts a button onto the sheet.
That is, the machinery itself works. But the ClassName parameter set to "Shell.Explorer.2" doesnít. That means, you can try to find a ProgId (see the page above) that suits your needs.


I don't think that we can help you with this issue as it doesn't relate to our specialization: as you know we do Office extensions.

Thinking about my suggestion above, I suppose you can use WebView2 but 1) this is a guess, and 2) I know nothing about WebView2.

Also, I would suggest that you try to do this in the PowerPoint UI. If it works, do the same while recording a VBA macro in *Excel*; the macro will provide you with method call(s) and parameters: PowerPoint requires almost the same parameters.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Sep, 2022 04:31:27 Top
chris chen




Posts: 2
Joined: 2022-03-15
Hi Andrei,

thank you for your help, I have successfully inserted the chrome browser into slide. I have another question: how to register event handle for a shape to listen resize, drag or drop event.
        PowerPoint.Shape webBrowserShape = null;
        private void adxRibbonButton1_OnClick(object sender, IRibbonControl control, bool pressed)
        {
            webBrowserShape =
            PowerPointApp.ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(
                144,
                138,
                480,
                360,
                "Shell.Explorer.2",
                "",
                Microsoft.Office.Core.MsoTriState.msoFalse,
                "",
                -1,
                "",
                Microsoft.Office.Core.MsoTriState.msoFalse);
           //register event handle for the PowerPointApp.ActiveWindow.Selection.SlideRange.Shapes
        }
Posted 23 Sep, 2022 23:01:09 Top
Andrei Smolin


Add-in Express team


Posts: 18420
Joined: 2006-05-11
Hello Chris,

Use the approach the sample add-in in Excel shapes events: getting notified about user actions demonstrates.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Sep, 2022 04:08:45 Top