-
Automation DLL
I have an automation DLL (OPCdaauto.Dll) that implements several interfaces.
I add it using Add Reference command and all interfaces of the DLL are available.
But i cannot call functions that wait for a array of long.
Looking at the prototypes in the references browser (F2) the format is :
sub Remove(NumItems as Long, ServerHandles() as Long, Errors() as Long)
and i call the method like this:
dim numitems as long
dim serverhandles(10) as long
dim errors(10) as long
numitems=1
serverhandles(0)=1
errors(0)=0
items.Remove NumItems,serverhandles,errors
' i try too
items.Remove NumItems,serverhandles(),errors()
i have an exception with description :
Incompatible type
What could be my problem ?
How to exactly now what the dll is waiting for (i have no documentation) ?
thanx
-
Re: Automation DLL
I am not very sure, if this can solve your problem.. just a shot in air :-)
Declare your arrays not as predefined size. ie.
dim numitems as long
dim serverhandles() as long
dim errors() as long
Redim serverhandles(10) as long
Redim Errors(10) as long
numitems=1
serverhandles(0)=1
errors(0)=0
items.Remove NumItems,serverhandles,errors
RK
-
Re: Automation DLL
I try it.
I have an error but it is not the same.
In first case (my code) the error was incompatible type.
With your code the error was argument or procedure call incorrect.
-
Re: Automation DLL
If the DLL was written in C, you will have to send the first element of the array ByRef. C functions (like API) expect a pointer to the first element in an array, so pass the array ByRef as follows:
myArray(0).
-
Re: Automation DLL
Yes already try it. Didnt work.