CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Automation DLL

  1. #1
    Join Date
    May 1999
    Posts
    318

    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




  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    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

  3. #3
    Join Date
    May 1999
    Posts
    318

    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.



  4. #4
    Join Date
    Jul 1999
    Posts
    145

    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).


  5. #5
    Join Date
    May 1999
    Posts
    318

    Re: Automation DLL

    Yes already try it. Didnt work.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured