get ComException with errorcode 0x80004005 when calling AddOLEObject RRS feed

  • Question

  • Hi, everybody. 

       i am using VSTO to develop a powerpoint addin. it is written in C#.

       and i had made 2 OLE controls. one of them is a ocx control (progID="ctrl1") by MFC. and another, i made it by C# whose progID is "ctrl2".

       yes the 2nd one is a .net framework user control library. and i defined a com interface by [System.Runtime.InteropServices]. it worked perfectly when i drag it from the toolbox of powerpoint. and i had used a vba code to add it onto a slide, just like 

          Slide1.Shapes.AddOLEObject 0,0,-1,-1,"ctrl2"

    and also it works fine.

          but only when i was using a C# code in VSTO,  written as

                      PowerPoint.Presentation pres = Globals.ThisAddIn.Application.Presentations[1];


          it  throwed a  ComException with a errorcode 0x80004005.

          and but,

                     pres.Slides[1].Shapes.AddOLEObject(0,0,-1,-1,"ctrl1");  works fine.

          now see my situation:

              add MFC control "ctrl1" from toolbox ---------------------- OK

              add MFC control "ctrl1" by VBA code ----------------------  OK

              add MFC control "ctrl1" by VSTO C# code ----------------  OK

              add FrameWork  control "ctrl2"  from toolbox  ------------OK

              add FrameWork  control "ctrl2"  from VBA code  ----------OK

              add FrameWork  control "ctrl2"  from VSTO C# code  ----NG  this is very wired. didn't it ?

          enviroment: Office2010, VSTO2010, VS2013

         thank you for any help.

    Monday, April 14, 2014 9:44 AM

All replies

  • Hello Dazeng,

    I'd recommend starting from registry entries for both components. Is there any difference in the windows registry?

    Monday, April 14, 2014 3:39 PM

  • thank for your reply, Eugene. I confirmed the registry. they are similar. Because the .Net control must begin with mscoree.dll, so the value of [InprocServer32] is different, and this is normal i think. And for the vba code works fine,i suppose that the registry is not the reason. 

    Tuesday, April 15, 2014 12:29 AM