Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81543

Cannot find Application.WordBasic.DisableAutoMacros

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.14.2, 5.15.0 Alpha
    • 5.9.9, 5.10.1, 5.11.3, 5.12.6, 5.13.2, 5.14.0
    • ActiveX Support
    • None
    • Windows 10, Office 2010
    • Windows
    • 974bead30f32a832180126944973c82f5bc6f6e2 (qt/qtactiveqt/5.14)

    Description

      Code example:

      CoInitialize(NULL);
      QAxObject *app = new QAxObject("Word.Application");
      QAxObject *wordBasic = app->querySubObject("WordBasic");
      wordBasic->dynamicCall("DisableAutoMacros(bool)", QVariant(true));
      

      It will throw an error

      QAxBase: Error calling IDispatch member DisableAutoMacros: Member not found

      I found out that IDispatch::Invoke only accepts a NULL pVarResult argument for DisableAutoMacros method.

      Here is my naive patch for Qt 5.12.6 

      --- qaxbase.cpp	2019-11-05 15:47:56.000000000 +0800
      +++ qaxbase.cpp	2020-01-21 10:23:06.693994100 +0800
      @@ -4005,6 +4005,11 @@
           UINT argerr = 0;
       
           HRESULT hres = Invoke(disp, dispid, IID_NULL, LOCALE_USER_DEFAULT, disptype, &params, res, &excepinfo, &argerr);
      +    if (hres == DISP_E_MEMBERNOTFOUND && (disptype & DISPATCH_METHOD) != 0) {
      +        memset(&excepinfo, 0, sizeof(excepinfo));
      +        argerr = 0;
      +        hres = Invoke(disp, dispid, IID_NULL, LOCALE_USER_DEFAULT, disptype, &params, nullptr, &excepinfo, &argerr);
      +    }
       
           if (disptype == (DISPATCH_METHOD|DISPATCH_PROPERTYGET) && hres == S_OK && varc) {
               for (int i = 0; i < varc; ++i)
      
      

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-81543
          # Subject Branch Project Status CR V

          Activity

            People

              kleint Friedemann Kleint
              xuzhen xuzhen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes