Results 1 to 2 of 2

Thread: Using array with QAxWidget::dynamicCall() function

  1. #1
    Join Date
    May 2010
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Using array with QAxWidget::dynamicCall() function

    Hi there!

    I have the following problem: when calling this function
    Qt Code:
    1. QAxWidget *dataq;
    2. // more code, i is the number of values to read
    3. QList<QVariant> res_array;
    4. for (int j=0; j<i; j++)
    5. res_array.append(0);
    6. dataq->dynamicCall("GetDataEx(int&, int)", res_array, i );
    To copy to clipboard, switch view to plain text mode 

    it crashes with the following error:
    Heap block at 0980F7A0 modified at 0980F7AA past requested size of 2
    Looks like I have not allocated the memory correctly but how could I do it otherwise?

    Cheers, Tom

  2. #2
    Join Date
    May 2010
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using array with QAxWidget::dynamicCall() function

    Maybe I should add that the com object provides access to a I/0-board attached via USB. The GetDataEx() function has as parameters the (empty) array and the number of points that should be read. It then fills the array with the requested number of 16-Bit integers.

    Lines 3-6 are part of a function that is called whenever there are new datapoints available, where "i" is the number of datapoints.

    I have checked in the debugger that res_array is initialized correctly and increasing its size does not change the problem.

Similar Threads

  1. Problem calling a routine with dynamicCall
    By franco.amato in forum Qt Programming
    Replies: 10
    Last Post: 10th May 2010, 17:59
  2. Replies: 0
    Last Post: 16th April 2010, 23:21
  3. Problems passing an array of pointers to objects to a function
    By Valheru in forum General Programming
    Replies: 16
    Last Post: 30th June 2008, 00:11
  4. Replies: 1
    Last Post: 28th May 2008, 16:52
  5. QtScript : passing array as argument into function
    By derek_r in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2007, 10:46

Tags for this Thread

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.