Hello,
I have two problems with some COM library.
- Indexers - in manual they said that to set property i should use: UserField(name) = new_value, this work in get (so i can do value=UserField(name)) but not set, also set method for this property have no argument name only Value.
[code]
UserField As String
Set
#if TargetWindows
If mThis = Nil Then Raise New NilObjectException
Dim func As New UserField_Put_Func1( mThis.Ptr( 0 ).Ptr( 144 * COM.SIZEOF_PTR ) )
Dim Local_rhs_Param As Ptr
Local_rhs_Param = COM.SysAllocString( value )
Dim resultCode As Integer = func.Invoke( mThis, Local_rhs_Param)
If 0 = resultCode Then
Else
Raise New COM.COMException("Failed on UserField, resultCode )
End If
COM.SysFreeString( Local_rhs_Param )
#endif
End Set
End Property[
/code]
There is also method in this object called UserField:
Function UserField(bstrName_Param As String) As Variant
#if TargetWin32
If mThis = Nil Then Raise New NilObjectException
Dim func As New UserField_Get_Func2(mThis.Ptr( 0 ).Ptr(143 * COM.SIZEOF_PTR ))
Dim resultCode As Integer
Dim Local_bstrName_Param As Ptr
Local_bstrName_Param = COM.SysAllocString( bstrName_Param )
Dim Return_pvValue_Param As Ptr
Dim pvValue_Param_MB As New MemoryBlock(16)
Return_pvValue_Param = pvValue_Param_MB
resultCode = func.Invoke(mThis, Local_bstrName_Param, Return_pvValue_Param)
COM.SysFreeString(Local_bstrName_Param)
If resultCode = 0 Then
Dim retVal As Variant = COM.VARIANTToRBVariant(Return_pvValue_Param)
COM.FreeVARIANT(Return_pvValue_Param)
Return retVal
Else // Throw Exception
Raise New COM.COMException("Failed on UserField, resultCode)
End If
#endif
End Function
- For Each - some of the objects returns list which regarding manual i can use in this loop, but in Xojo i cant, because of This object does not implement the Iterable interface and cannot be used in a For Each loop
Obejct returns:
Deliveries As Iterator
Get
#if TargetWindows
If mThis = Nil Then Raise New NilObjectException
Dim ppVal_Param As Ptr
Dim func As New Dostawy_Get_Func1( mThis.Ptr( 0 ).Ptr( 14 * COM.SIZEOF_PTR ) )
Dim resultCode As Integer = func.Invoke( mThis, ppVal_Param )
If 0 = resultCode Then
If Nil <> ppVal_Param Then
Return New InsERT.Iterator( ppVal_Param )
End If
Else
Raise New COM.COMException("Failed on Dostawy", resultCode )
End If
#endif
End Get
End Property
Iterator have super COM.IDispatch and following members:
Delegates:
ElementsCount_Get_Func1
_NewEnum_Func1
Methods:
Protected Sub Constructor
// This class is not instantiable
End Sub
Sub Operator_Convert(rhs As COM.IUnknown)
#if TargetWin32
If rhs.Handle = Nil Then Return
Dim p As Ptr
If 0 = rhs.QueryInterface( InsERT.Iterator.IID, p ) Then
mThis = p
Else
Raise New IllegalCastException
End If
#endif
End Sub
Function _NewEnum As COM.IUnknown
#if TargetWin32
If mThis = Nil Then Raise New NilObjectException
Dim func As New _NewEnum_Func1(mThis.Ptr( 0 ).Ptr(7 * COM.SIZEOF_PTR ))
Dim resultCode As Integer
Dim Return_ppvObject_Param As Ptr
resultCode = func.Invoke(mThis, Return_ppvObject_Param)
If resultCode = 0 Then
If Nil = Return_ppvObject_Param Then Return Nil
Return New COM.IUnknown(Return_ppvObject_Param)
Else // Throw Exception
Raise New COM.COMException("Failed on _NewEnum", resultCode)
End If
#endif
End Function
Property:
ElementsCount As Integer
Get
#if TargetWindows
If mThis = Nil Then Raise New NilObjectException
Dim pVal_Param As Integer
Dim func As New ElementsCount_Get_Func1( mThis.Ptr( 0 ).Ptr( 8 * COM.SIZEOF_PTR ) )
Dim resultCode As Integer = func.Invoke( mThis, pVal_Param )
If 0 = resultCode Then
Return pVal_Param
Else
Raise New COM.COMException("Failed on ElementsCount, resultCode )
End If
#endif
End Get
End Property
Shared Methods:
IID
All code above is generatoed by Xojo after Insert/ActiveX Component/References. Most of the code from this module is working without problems after some corrections (data types for example) to the module but i dont know what should i do about those indexers and For Each. I should mention that my application is x64. I am using Xojo 2019 Release 1.1. I will appreciate any help.