Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ActiveQt dynamic call with a VARIANT* data type

ActiveQt dynamic call with a VARIANT* data type

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 4.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adam3914
    wrote on last edited by VRonin
    #1

    I am having some trouble using the dynamicCall function of a QAxObject to call a activeX function that uses the VARIANT* data type

    here is the header for the ActiveX function

    HRESULT ScanUSB([out] VARIANT* serialNumbers);

    here is the documentation generated for the activeX function using the generateDocumentation function
    void ScanUSB (QVariant& serialNumbers) [slot]

    method ScanUSB

    Connect a signal to this slot:

    QObject::connect(sender, SIGNAL(someSignal(QVariant&)), object, SLOT(ScanUSB(QVariant&)));

    Or call the function directly:

     QVariantList params = ...
     object->dynamicCall("ScanUSB(QVariant&)", params);
    

    and here is my code

    QVariant serials;
     QList<QVariant> param;
     param<<serials;
     cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt();
    

    the function returns with out errors, i just don't get any data back

    Y 1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      you try to call a method which gets a QVariant and put in a QList of QVariant. This mit be the problem. Wrap everything in a QVariant.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A adam3914

        I am having some trouble using the dynamicCall function of a QAxObject to call a activeX function that uses the VARIANT* data type

        here is the header for the ActiveX function

        HRESULT ScanUSB([out] VARIANT* serialNumbers);

        here is the documentation generated for the activeX function using the generateDocumentation function
        void ScanUSB (QVariant& serialNumbers) [slot]

        method ScanUSB

        Connect a signal to this slot:

        QObject::connect(sender, SIGNAL(someSignal(QVariant&)), object, SLOT(ScanUSB(QVariant&)));

        Or call the function directly:

         QVariantList params = ...
         object->dynamicCall("ScanUSB(QVariant&)", params);
        

        and here is my code

        QVariant serials;
         QList<QVariant> param;
         param<<serials;
         cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt();
        

        the function returns with out errors, i just don't get any data back

        Y Offline
        Y Offline
        yougangZong
        wrote on last edited by
        #3

        @adam3914 said in ActiveQt dynamic call with a VARIANT* data type:

        I am having some trouble using the dynamicCall function of a QAxObject to call a activeX function that uses the VARIANT* data type

        here is the header for the ActiveX function

        @HRESULT ScanUSB([out] VARIANT* serialNumbers);
        @

        here is the documentation generated for the activeX function using the generateDocumentation function
        @void ScanUSB (QVariant& serialNumbers) [slot]

        method ScanUSB

        Connect a signal to this slot:

        QObject::connect(sender, SIGNAL(someSignal(QVariant&)), object, SLOT(ScanUSB(QVariant&)));

        Or call the function directly:

        QVariantList params = ...
        object->dynamicCall("ScanUSB(QVariant&)", params);@

        and here is my code

        @QVariant serials;
        QList<QVariant> param;
        param<<serials;
        cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt()<<endl;@

        the function returns with out errors, i just don't get any data back

        did you solve the problem?

        EddyE 1 Reply Last reply
        0
        • Y yougangZong

          @adam3914 said in ActiveQt dynamic call with a VARIANT* data type:

          I am having some trouble using the dynamicCall function of a QAxObject to call a activeX function that uses the VARIANT* data type

          here is the header for the ActiveX function

          @HRESULT ScanUSB([out] VARIANT* serialNumbers);
          @

          here is the documentation generated for the activeX function using the generateDocumentation function
          @void ScanUSB (QVariant& serialNumbers) [slot]

          method ScanUSB

          Connect a signal to this slot:

          QObject::connect(sender, SIGNAL(someSignal(QVariant&)), object, SLOT(ScanUSB(QVariant&)));

          Or call the function directly:

          QVariantList params = ...
          object->dynamicCall("ScanUSB(QVariant&)", params);@

          and here is my code

          @QVariant serials;
          QList<QVariant> param;
          param<<serials;
          cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt()<<endl;@

          the function returns with out errors, i just don't get any data back

          did you solve the problem?

          EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by Eddy
          #4

          Hi yougangZong ,

          Do you have exactly the same ActiveX component?

          What is missing in this code :

          QVariant serials;//<----------------
          QList<QVariant> param;
          param<<serials;
          cout<<object.dynamicCall("ScanUSB(QVariant&)",param).toInt()<<endl;
          

          serials is not defined yet. So filling param with nothing.
          You can also use something like:

          QList<QVariant> param = {123};
          

          Eddy

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved