problem with external dll

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

    problem with external dll

    I have to use external dll written in C which has 4 functions inside
    for coding and decoding data.
    declaration of coding function is:

    void fun1 (char x1[4], char x2[9], char x3[4], char x4[4], char x5[4],
    char x6[11], char x7[11], char x8[11], char x9[20]);

    x1-x8 are incoming parameters and x9 is outgoing parameter

    My code in VB6 (but doesn't work):

    Declare Function Fun1 Lib "c:\mydll.d ll" (ByVal x1 As String, ByValx2
    As String, ByValx3 As String, ByValx4 As String, ByVal x5 As String,
    ByVal
    x6 As String, ByValx7 As String, ByVal x8 As String) As Variant

    Private Sub Command1_Click( )
    Dim TextLine As String
    Dim mydata(8) As String
    Dim x As Integer
    Dim text As String
    x = 1
    Open "c:\x.txt" For Input As #1 ' Open file.
    Do While Not EOF(1) ' Loop until end of file.
    Line Input #1, TextLine ' Read line into variable.
    mydata(x) = TextLine
    x = x + 1
    Loop

    text=Fun1(mydat a(1), mydata(2), mydata(3), mydata(4), mydata(5),
    mydata(6),
    mydata(7), mydata(8))
    msgbox text
    Close #1 ' Close file.

    End Sub

    after running aplication, msgbox gives me nothing in text variable.
    It's my first attempt to work with dll so I don't know is it ok or
    maybe dll is wrong. Can someone help me to write regular code.
    thanks
Working...