4 Replies Latest reply on May 20, 2010 9:56 AM by ATARIFDS

    How to troubleshoot failed launch of ActiveX control (MFC/WIN32)

    ATARIFDS

      I'm really hoping someone out there can help with this one....

       

      The issue is that some clients of ours can't seem to launch the Acrobat Reader through the MFC ActiveX wrapper (Create returns FALSE). It seems that sometimes a re-install of the Acrobat Reader tends to fix the issue but sometimes it does not. Since it is written in MFC/WIN32 it makes it hard to troubleshoot and I can't seem to find any support out there related to this.

       

      This is the code we have to create the ActiveX window with the Acrobat Reader inside of it:

       

      class AdobeWnd : public CWnd {
      protected :
         DECLARE_DYNCREATE(AdobeWnd)
      public:
         CLSID const& GetClsid() {
         static CLSID const clsid = { 0xCA8A9780, 0x280D, 0x11CF, { 0xA2, 0x4D, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
         return clsid;
      }
      virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,  CCreateContext* pContext = NULL) {
           return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
      }

       

      This was generated from the ActiveX class wizard in VS2008.... I have gotten regmon dumps from these "bad" client computers but I can't seem to tell if a regkey or something is missing which is causing this issue. Is there any advice out there to try? I would love to write a tool that could "check" the setup to see if there is a regkey missing or something similiar to explain to these clients why their reader is not launching. Note - the reader launches just fine when launched by clicking on a PDF.

       

      Thanks everyone.

        • 1. Re: How to troubleshoot failed launch of ActiveX control (MFC/WIN32)
          triendl.kj

          We've had recently the same problem with a customer - the activex control suddenly stopped working.

           

          In the end it turned out that acrobat's option 'show pdf in browser' (on the webbrowser option group in the setting category for internet) was (unexpectedly) disabled on the customer's PC.

           

          There are two possibilities to get at least an error message directly from the COM/ActiveX layer: one is javascript embedded in a html file (that only works with IE because only IE supports ActiveX), the other is c++ code instantiating the acrobat control via COM.

           

          The outline of the code is as follows:

           

          javascript:

          function testfunction()
          {
               try
               {
                    // create acrobat control via ActiveX
                    var acropdf = new ActiveXObject('AcroPDF.PDF.1');
                    var strV = acropdf.GetVersions();
               }
               catch (e)
               {
                    // error object has some interesting information:
                    // 'e' can be used in a string context, additionally it's members provide detailed error information;
                    // e's members: e.name, e.number, e.message, e.description
               }
          }
          

           

          c++ (Visual Studio):

          #import "AcroPDF.dll"
          void testfunction()
          {
               AcroPDFLib::IAcroAXDocShimPtr     pPDFDoc_Version7Plus;
               try
               {
                    HRESULT hr = pPDFDoc_Version7Plus.CreateInstance(__uuidof(AcroPDFLib::AcroPDF));
                    if (FAILED(hr))
                         _com_issue_error(hr);
          
                    _bstr_t strV = pPDFDoc_Version7Plus->GetVersions();
               }
               catch (const _com_error& err)
               {
                    // err.Error();
                    // err.ErrorMessage();
                    // err.Description();
               }
          }
          

           

          If you're interested I can provide the whole projects for the two tools (one is a html file, the other is a VS2008 project and the resulting exe).

          • 2. Re: How to troubleshoot failed launch of ActiveX control (MFC/WIN32)
            ATARIFDS Level 1

             

             

            Thanks for the reply! We actually stumbled across the same check-box option by mistake and that has solved our issue as well. It shouldn't be called "Show PDF In Browser" rather "Enable ActiveX Control"

             

            Would you happen to know how to check for that feature being enabled?

            • 3. Re: How to troubleshoot failed launch of ActiveX control (MFC/WIN32)
              triendl.kj Level 1

              Sorry for the wrong naming of the option - I'm using a german version and this has been just a quick translation

               

              I've just traced the registry access and it shows that Acrobat accesses the REG_DWORD value "HKCU\Software\Adobe\(Adobe Acrobat)|(Adobe Reader)\<version>\Originals\bBrowserIntegration". If this value is set to 0 then the ActiveX control can't be instantiated, if the value has a value different from 0 or is missing then the option is enabled.

              I'm not sure of course how Acrobat is programmed but it seems that it traverses all versions of Adobe Acrobat and Adobe Reader for the bBrowserIntegration registry value and then probably determines whether one of them has a value of 0.

               

              If it isn't what you're looking for!

              • 4. Re: How to troubleshoot failed launch of ActiveX control (MFC/WIN32)
                ATARIFDS Level 1

                Works perfectly! Thanks so much. Now we finally have a way to tell our client's IT staff to make sure this reg-key is set! Cheers!