Results 1 to 4 of 4

Thread: Call ActiveX function with struct parametr

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Call ActiveX function with struct parametr

    I need to call some ActiveX function and one of paramters is a struct

    While calling a "segmentation fault" exception raizes



    //test.h
    #include <ActiveQt/QAxWidget>
    #include "windows.h"
    #include <QMetaType>
    class MapAxWidget : public QAxWidget
    {
    public:
    MapAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
    void test();
    typedef struct
    {
    long ForeColor;
    long BackgroundColor;
    }TPWPalette;
    }
    Q_DECLARE_METATYPE(MapAxWidget::TPWPalette);

    //test.cpp

    MapAxWidget::MapAxWidget(QWidget* parent, Qt::WindowFlags f )
    : QAxWidget(parent, f)
    {

    setControl({829A0FF0-B154-4CA9-AAD9-3FFF0FA875FE});

    }
    void MapAxWidget::test()
    {
    TPWPalette t1;
    t1.ForeColor = 1;
    t1.BackgroundColor = 1;
    QVariant param1;
    param1.setValue(t1);
    dynamicCall("testMSg(TPWPalette pallet)",param1); //Error raizes here




    // qaxbase.cpp
    long QAxBase::queryInterface(const QUuid &uuid, void **iface) const
    {
    *iface = 0;
    if (!d->ptr) { //Error shows here
    }




    If one could help, will be gratefull.

    P.S. English is not native language, so i am sorry for mistakes
    Last edited by agealex; 23rd October 2010 at 12:56.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Call ActiveX function with struct parametr

    The following line:
    Qt Code:
    1. dynamicCall(testMSg("TPWPalette pallet)",param1); //Error raizes here
    To copy to clipboard, switch view to plain text mode 
    is completely wrong.

    The first parameter is a function name.
    You positioned the "" wrong (at least)
    Even if the "" are right, there's no function name there.

    The second parameter is a QVariant list, not just a QVariant.

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Call ActiveX function with struct parametr

    dynamicCall("testMSg(TPWPalette pallet)",param1); //Error raizes here

    Sorry i'v made a mistake when was writting here. The question is the same

    and about function. There are 2 prototypes:
    QVariant QAxBase::dynamicCall ( const char * function, QList<QVariant> & vars )

    QVariant QAxBase::dynamicCall ( const char * function, const QVariant & var1 = QVariant(), const QVariant & var2 = QVariant(), const QVariant & var3 = QVariant(), const QVariant & var4 = QVariant(), const QVariant & var5 = QVariant(), const QVariant & var6 = QVariant(), const QVariant & var7 = QVariant(), const QVariant & var8 = QVariant() )

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Call ActiveX function with struct parametr

    Quote Originally Posted by agealex View Post
    and about function. There are 2 prototypes:
    QVariant QAxBase::dynamicCall ( const char * function, QList<QVariant> & vars )

    QVariant QAxBase::dynamicCall ( const char * function, const QVariant & var1 = QVariant(), const QVariant & var2 = QVariant(), const QVariant & var3 = QVariant(), const QVariant & var4 = QVariant(), const QVariant & var5 = QVariant(), const QVariant & var6 = QVariant(), const QVariant & var7 = QVariant(), const QVariant & var8 = QVariant() )
    Yes, indeed.
    The Qt docs linked to the bottom one which made me think there was only one.

Similar Threads

  1. Qt function call in vb.net
    By abghosh in forum Qt Programming
    Replies: 7
    Last Post: 6th March 2010, 17:00
  2. Replies: 0
    Last Post: 20th December 2009, 15:37
  3. Call to database function.
    By retto in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2009, 12:29
  4. call function as Qstring
    By jcr in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2009, 01:35
  5. function call
    By Walsi in forum Qt Programming
    Replies: 3
    Last Post: 12th June 2007, 09:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.