SafeArrayTypeMismatchException

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phoenix

    SafeArrayTypeMismatchException

    Hi .NET Masters :-)

    Please help me to get out of following situation ...

    There is a function in one of my dlls whose signature is as follows :
    my_function(int eger X, integer Y, char* Z, HAD A, HAD P)

    Here HAD is defined as follows in one of the header files as :

    #define HAD LPSAFEARRAY FAR *


    The above dll was written in VC++ 6.0 . I use to call this function
    in my Visual Basic 6.0 application.

    Recently , I upgraded my Visual Basic application and found
    that its giving "SafeArrayTypeM ismatchExceptio n"

    Declaration for my Function is as follows :

    Declare Function my_function Lib "tcvbadm.dl l" (ByVal X As Integer,
    ByVal Y
    As Integer, ByVal Z As String, A() As String, A() As Integer) As
    Integer

    And the way I am calling in my VB application is as follows :

    Dim li_count as Integer
    ReDim la_leaf(li_coun t) As String
    ReDim la_access(li_co unt) As Integer

    retcode = my_function(X, Y, Z, A(), B()) ' HERE I AM GHETTING THE
    EXCEPTION
    WHERE AS IT WAS WORKING WELL PREVIOUSLY




    'I fetch li_count through a different fi=unction call which returns an
    integer value.


    Please let me know if any further info is reqd regarding this. Any
    help
    would be highly apprecaited ,
    Thanks a lot in advance.

    Thanks & Regards


    Sudhansu Tiwari

  • Aneesh Pulukkul

    #2
    Re: SafeArrayTypeMi smatchException

    On Jun 5, 8:00 pm, Phoenix <sudhansutiw... @gmail.comwrote :
    Hi .NET Masters :-)
    >
    Please help me to get out of following situation ...
    >
    There is a function in one of my dlls whose signature is as follows :
    my_function(int eger X, integer Y, char* Z, HAD A, HAD P)
    >
    Here HAD is defined as follows in one of the header files as :
    >
    #define HAD LPSAFEARRAY FAR *
    >
    The above dll was written in VC++ 6.0 . I use to call this function
    in my Visual Basic 6.0 application.
    >
    Recently , I upgraded my Visual Basic application and found
    that its giving "SafeArrayTypeM ismatchExceptio n"
    >
    Declaration for my Function is as follows :
    >
    Declare Function my_function Lib "tcvbadm.dl l" (ByVal X As Integer,
    ByVal Y
    As Integer, ByVal Z As String, A() As String, A() As Integer) As
    Integer
    >
    And the way I am calling in my VB application is as follows :
    >
    Dim li_count as Integer
    ReDim la_leaf(li_coun t) As String
    ReDim la_access(li_co unt) As Integer
    >
    retcode = my_function(X, Y, Z, A(), B()) ' HERE I AM GHETTING THE
    EXCEPTION
    WHERE AS IT WAS WORKING WELL PREVIOUSLY
    >
    'I fetch li_count through a different fi=unction call which returns an
    integer value.
    >
    Please let me know if any further info is reqd regarding this. Any
    help
    would be highly apprecaited ,
    Thanks a lot in advance.
    >
    Thanks & Regards
    >
    Sudhansu Tiwari
    Note the mapping of data types:
    VB6 -VB.NET
    ------------------------
    Integer - Short
    Long - Integer

    Try re- declaring variables.



    Comment

    Working...