ActiveX issue

Hello,

Recently I´ve added an ActiveX (MBaxp) in Xojo in order to develop a Modbus Master Control. Mostly of the ActiveX functions works fine, but I´ve found some problems with to parts of the ActiveX:
1 - Problems accessing to functions with a byref argument
2 - Property and method names are shared in this ActiveX

I´ve been looking up in forums and I’ve found some doubts about this ActiveX, but not successfully ended.

The conclusions drawn are that I have to change some code of the ActiveX, because it´s possible that the code rendered from the ActiveX by Xojo is wrong for it. For example, the WriteCoilArray function has the following syntax in the help examples:
Visual Basic
Function WriteCoilArray (Handle As Integer, Index As Integer, Quantity As Integer, pRegisters As Integer) As Integer
Visual C++
short WriteCoilArray (short Handle, short Index, short Quantity, short* pRegsters);
The imported function by Xojo is:
WriteCoilArray (Handle_Param As Int16, Index_Param As Int16, Quantity_Param As Int16, ByRef pCoils_Param As Int16) as Int16

I´ve not been able to successfully run this function, because generates this exception: h80020005
I´ve tried with int16 arrays, int16 single variables, memoryblocks… but it never works (I’ve change the argument to an array indeed)

On the other hand, the ActiveX has methods and properties with the same name:
For example “Register” is a property, but when I need to access like in the example in the help the method should be accessed instead, but Xojo reports an error
Example: Mbaxp1.Register(1, 0) = 1 (this is not array but you are using it as one)

I´m very confused because I change the method name and sometimes Xojo doesn´t recognize it. I don’t know if I have to change the name of all occurrences or not (this ActiveX loads a MBAxpLib and a Mbaxp control)
The properties have Get and Set methods, but I don´t know if I have to change the Get or Set property by the method, and how. I´ve tried to change to “extends” and “assigns” but I can´t get anything.
Summarize:
Is right the assumption that I have to change some code the ActiveX imported?? Could someone give some guidelines to do it??
Could be any problems with the parameter type change (integer to int16) in the byref argument??

Thanks in advance!!

Assuming the c++ example you gave is correct, the signature from Xojo is also correct. It could also be that the underlying function call (in Xojo) isn’t quite correct though.

Thanks Greg

I think I resolved the part of the shared name.
However I still have problems with the BYREF-ActiveX part. I´ve tried to check another activeX control with byref arguments and it has the same behaviour.

Is there any incompatibilty with XOJO and byrefs arguments in ActiveX controls??

I´ve resolved the Byref problem when the type is integer, I needed to get the address of the propierty and then pass to the byref argumente.

However I´m not able to do the same with the int16 byref argument, always says error 80020005h.

Some tip?

Hi! I’ve to develop a similar application and I’ve found the same activeX.
I need to poll some plc registries and put their values in a SQL table.

According to your experience, this activeX is simple to include and work with?