I have a third party ActiveX control that we would like to use in the HMI as it is used thoroughly in the company and having it in the HMI would be useful.
So the creation part part is easy with the ActiveX Module. The interface that the component exposes is fairly complex and has many child objects that return IDispatch pointers.
I realize this is probably going of into unsupported land but hoping this might be a softball.
The code I think should look something like the following:
[code]ax = event.source.parent.getComponent(‘Generic ActiveX Control’)
print ax.getProperty(‘Color’, )
plotvt = ax.getVariantProperty(‘Plot’, ) # plot is an IDispatchImpl property
plot = ax.getAutomationObject(plotvt, )
The first part to get the Color property of the main control works fine. The subsequent call to get the object as a variant fails. Basically it returns “com.jniwrapper.win32.automation.impl.IDispatchImpl cannot be cast to com.jniwrapper.win32.automation.types.Variant”.
The Variant wrapper object should be able to create a variant to house the IDispatch pointer but is just trying to do a straight up cast which is not useful here. If I use ax.getProperty(‘Plot’,) it returns an IDispatchImpl but I cannot use that directly (well maybe with great pain) but that is what the Automation wrapper is for. I was hoping it would create a Variant to house it to call getAutomationObject with in this instance but no go.
Is it possible to import the jni wrapper libraries in jython to wrap the Automation or variant myself? Is there some other way to achieve this?