Results 1 to 12 of 12

Thread: Using ActiveX controls and dumpcpp

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Using ActiveX controls and dumpcpp

    Did you read my last answer?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. The following user says thank you to high_flyer for this useful post:


  3. #2
    Join Date
    Jun 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using ActiveX controls and dumpcpp

    to high_flyer:
    did you mean that I have to use this function "QVariant QAxBase::dynamicCall ( const char * function, QList<QVariant> & vars )"?, in my last post, I have used this function for dynamicCall() as follwing:

    Qt Code:
    1. QString str5 = "doGetMeasureDataEx(int, double&, double&, double&)";
    2. QList<QVariant> vars5;
    3. QVariant res5;
    4. vars5 << 1 << 0.0 << 0.0 << 0.0 ;
    5. res5 = doSpot->dynamicCall(str5.toLatin1(), vars5);
    To copy to clipboard, switch view to plain text mode 

    I don't understand your meaning completely, please give me more explanation. thank for your answer.

  4. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Using ActiveX controls and dumpcpp

    Sorry, for some reason my brain saw 'res5' instead of 'vars5'.

    So do you mean 'vars5' has only one element in the list after the call?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #4
    Join Date
    Jun 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using ActiveX controls and dumpcpp

    to high_flyer:
    following code is the function prototype described in manual:

    "short doGetMeasureDataEx(short iDev, float* x, float* y, float* p);"

    the argument 0 ("iDev") is in-parameter. Arguments 1, 2 and 3("x", "y", "p") are out-parameter, two element array and pointer, so, I should get 6 values totally. these 6 values are stored in x[0], x[1], y[0], y[1], p[0], p[1].

    and in my qt' test program, after calling "dynamicCall()" in my machine, the vars5 is: vars5[0] = 1, vars5[1] = -12.143, vars5[2] = -0.973, vars5[3] = 0.812. ie, vars5[0] = iDev, vars5[1] = x[0], vars5[2] = y[0], vars5[3] = p[0]. I can't get x[1], y[1], p[1] values.

    the Qvariant can be used as a pointer? thank for your answer.

  6. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Using ActiveX controls and dumpcpp

    Ah... now I see that you didn't use the correct function signature - you have pointers as params but you were using references...
    You used:
    Qt Code:
    1. QString str5 = "doGetMeasureDataEx(int, double&, double&, double&)";
    To copy to clipboard, switch view to plain text mode 
    Where as the function signature is:
    Qt Code:
    1. short doGetMeasureDataEx(short iDev, float* x, float* y, float* p);
    To copy to clipboard, switch view to plain text mode 
    So no wonder it doesn't work.

    What you can try, is cast the double pointer addresses to long, set that as your QVariable, and then cast back after the call:
    Qt Code:
    1. double var1 = 0.0;
    2. double var2 = 0.0;
    3. ...
    4. QVariant pDouble1 = (long)&var1;
    5. QVariant pDouble2 = (long)&var2;
    6. ..
    7. QList<QVariant> varList;
    8. varList << pDouble1 << pDouble 2.... ;
    9. res5 = doSpot->dynamicCall(str5.toLatin1(), varList ); //use the correct signature with pointers!!
    10. double *pVar = varList.at(0);
    11. var1 = *pVar;
    To copy to clipboard, switch view to plain text mode 

    I don't know if this will work, this is just something I would try.
    Last edited by high_flyer; 25th July 2011 at 14:48.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #6
    Join Date
    Jun 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using ActiveX controls and dumpcpp

    hello:
    I use dumpcpp to create a "dospotpc.h" and "dospotpc.cpp" file before: "dumpcpp {74676A0F-BB65-48A0-8044-F453692E9A8A} -o dospotpc"
    In file "dospotpc.h", this function prototype is:
    Qt Code:
    1. inline int doGetMeasureDataEx(int numDev, double& Xo, double& Yo, double& Po);
    To copy to clipboard, switch view to plain text mode 
    so, I use this code to call "dynamicCall()" function:
    Qt Code:
    1. QString str5 = "doGetMeasureDataEx(int, double&, double&, double&)";
    To copy to clipboard, switch view to plain text mode 
    I don't know why the function argument transform from pointer type to reference type.

  8. #7
    Join Date
    Jun 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using ActiveX controls and dumpcpp

    it doesn't seem to work successfully. I try this and get some errors while compile.

Similar Threads

  1. ActiveX - Integrate dumpcpp interfaces
    By durbrak in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2011, 06:54
  2. compilation error when including dumpcpp output
    By Jimmy2775 in forum Qt Programming
    Replies: 13
    Last Post: 14th May 2010, 04:12
  3. Replies: 0
    Last Post: 29th March 2010, 03:46
  4. Hiding controls changes spacing of other controls
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2007, 20:47
  5. Integrating dumpcpp in VS build
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2007, 17:48

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
  •  
Qt is a trademark of The Qt Company.