none
System.Runtime.InteropServices.COMException was unhandled

    Question

  • Hello,

    I ran in to this problem while loading the pdf reader X. I use microsoft visual c sharp 2010.

    The code at the origin is (in Form1.Designer) :

    ((System.ComponentModel.

    ISupportInitialize)(this

    .axAcroPDF2)).EndInit();

    and the error details are :

    System.Runtime.InteropServices.COMException was unhandled
      Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
      Source=System.Windows.Forms
      ErrorCode=-2147221164
      StackTrace:
           at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
           at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
           at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
           at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
           at System.Windows.Forms.AxHost.CreateInstance()
           at System.Windows.Forms.AxHost.GetOcxCreate()
           at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
           at System.Windows.Forms.AxHost.CreateHandle()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.AxHost.EndInit()
           at MHR_Tool_version_2._.Form1.InitializeComponent() in C:\Users\epoitr1\Desktop\MHR Tool version 2.1\MHR Tool version 2.1\MHR Tool version 2.1\Form1.Designer.cs:line 1752
           at MHR_Tool_version_2._.Form1..ctor() in C:\Users\epoitr1\Desktop\MHR Tool version 2.1\MHR Tool version 2.1\MHR Tool version 2.1\Form1.cs:line 19
           at MHR_Tool_version_2._.Program.Main() in C:\Users\epoitr1\Desktop\MHR Tool version 2.1\MHR Tool version 2.1\MHR Tool version 2.1\Program.cs:line 17
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    Tuesday, June 14, 2011 7:58 PM

Answers

  • Those are not COM server dlls, but interop assemblies generated from type libraries.

    If your computer is 64bit and the target platform of your project is not the same as the version of Adobe Acrobat Reader, change the target platform to match. For more information about using AcroPDFLib on 64bit computers, search "AcroPDFLib 64bit" on forums.adobe.com.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Tuesday, June 14, 2011 8:44 PM
  • Thanks for all your help!

     

    I added a link to the info you pointed to for others to follow, it resolved my problem:

    http://social.msdn.microsoft.com/forums/en-us/Vsexpressvcs/thread/08ADC799-E705-47D1-940C-3F91EF442CEC

    Tuesday, June 14, 2011 9:11 PM

All replies

  • This means that your pdf reader is not registered on the computer. You need to find the ocx or dll file which contains the control and register it using regsvr32.
    Tuesday, June 14, 2011 8:04 PM
  • Thank you for your quick reply; when I attempt to register the .dll file I get a message saying that the module was loaded but the entry point was not found. It then asks me to verify whether the .dll file is valid.

    I was wondering how can I know or verify that the .dll file is valid? Is there a link where I can download a valid one for the .pdf reader?

    The two .dll files I am using are :

    AxInterop.AcroPDFLib.dll

    Interop.AcroPDFLib.dll

    Thanks!

    Tuesday, June 14, 2011 8:30 PM
  • Those are not COM server dlls, but interop assemblies generated from type libraries.

    If your computer is 64bit and the target platform of your project is not the same as the version of Adobe Acrobat Reader, change the target platform to match. For more information about using AcroPDFLib on 64bit computers, search "AcroPDFLib 64bit" on forums.adobe.com.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Tuesday, June 14, 2011 8:44 PM
  • Thanks for all your help!

     

    I added a link to the info you pointed to for others to follow, it resolved my problem:

    http://social.msdn.microsoft.com/forums/en-us/Vsexpressvcs/thread/08ADC799-E705-47D1-940C-3F91EF442CEC

    Tuesday, June 14, 2011 9:11 PM
  • Thanks for sharing your solution.
    Best Regards,
    Rocky Yue[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Friday, June 17, 2011 2:47 AM
  • I have the Answer   

    Edit:  On the "Settings" submenu of the "Tools" menu, select "Expert settings" 

    1.  On the "Tools" menu, click "Options".

    2.  Check "Show all settings".

    3.  Expand "Projects and Solutions and click General".

    4.  Check "Show advanced build configurations".

    5.  Click "OK"

    6.  On the "Build" click "Configuration Manager...".  (Add it if it isn't there)

    7.  In the "Acitve solution platform:" drop down, click "<New...>".

    8.  In the "Type or select the new platform:" drop down, click "x86".

    9.  Click "OK".

    10.  Click "Close".

    11.  Build the project.

    Then when you generate the .exe use the \bin\x86\Release inside 

    its working

    Friday, June 13, 2014 2:14 PM