Click to See Complete Forum and Search --> : Automation DLL


eric33
October 29th, 1999, 04:36 AM
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

Ravi Kiran
October 29th, 1999, 05:04 AM
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

eric33
October 29th, 1999, 06:32 AM
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.

Mikesc
October 29th, 1999, 09:32 AM
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).

eric33
October 29th, 1999, 12:08 PM
Yes already try it. Didnt work.