<div dir="ltr">It worked! Thanks, been trying every combo I could think of for two days!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 August 2014 17:30, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 21/08/2014 1:50 am, Sam Myers wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm having trouble sending a parameter by reference using dyncamicCall to<br>
an ActiveX object. The command GetNumHWUnits should set the second<br>
parameter to 2, but doesn't change it. The equivalent code works in LabVIEW<br>
so I'm reasonably confident in the command order. Any hints?<br>
<br>
import sys<br>
from PyQt4 import QtGui<br>
from PyQt4 import QAxContainer<br>
from PyQt4.QtCore import QVariant<br>
from PyQt4.QtGui import QMainWindow, QApplication<br>
<br>
class APTSystem(QMainWindow):<br>
<br>
def __init__(self):<br>
<br>
QMainWindow.__init__(self)<br>
<br>
apt = QAxContainer.QAxWidget(self)<br>
self.setCentralWidget(apt)<br>
<br>
apt.setControl('{B74DB4BA-<u></u>8C1E-4570-906E-FF65698D632E}') # system<br>
<br>
apt.dynamicCall('StartCtrl()')<br>
<br>
typ = QVariant(6)<br>
num = QVariant(0)<br>
<br>
apt.dynamicCall('<u></u>GetNumHWUnits(int, int&)', [typ, num])<br>
<br>
print num.toInt() # value is always returned as zero, expecting 2!<br>
<br>
apt.dynamicCall('StopCtrl()')<br>
<br>
app = QtGui.QApplication(sys.argv)<br>
a = APTSystem()<br>
a.show()<br>
app.exec_()<br>
</blockquote>
<br></div></div>
The list itself is modified, try...<br>
<br>
args = [typ, num]<br>
apt.dynamicCall('Get...', args)<br>
print args[1].toInt()<br>
<br>
Phil<br>
______________________________<u></u>_________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.<u></u>com/mailman/listinfo/pyqt</a></blockquote></div><br></div>